home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 619 / lachck / lacheck.src / lacheck.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-17  |  75.0 KB  |  2,522 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* scanner skeleton version:
  4.  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. #include <stdio.h>
  10.  
  11.  
  12. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  13. #ifdef c_plusplus
  14. #ifndef __cplusplus
  15. #define __cplusplus
  16. #endif
  17. #endif
  18.  
  19.  
  20. #ifdef __cplusplus
  21.  
  22. #include <stdlib.h>
  23. #include <osfcn.h>
  24.  
  25. /* use prototypes in function declarations */
  26. #define YY_USE_PROTOS
  27.  
  28. /* the "const" storage-class-modifier is valid */
  29. #define YY_USE_CONST
  30.  
  31. #else    /* ! __cplusplus */
  32.  
  33. #ifdef __STDC__
  34.  
  35. #ifdef __GNUC__
  36. #include <stddef.h>
  37. void *malloc( size_t );
  38. void free( void* );
  39. #else
  40. #include <stdlib.h>
  41. #endif    /* __GNUC__ */
  42.  
  43. #define YY_USE_PROTOS
  44. #define YY_USE_CONST
  45.  
  46. #endif    /* __STDC__ */
  47. #endif    /* ! __cplusplus */
  48.  
  49.  
  50. #ifdef __TURBOC__
  51. #define YY_USE_CONST
  52. #endif
  53.  
  54. #ifdef atarist
  55. #include <stdlib.h>
  56. #include <string.h>
  57. #include <memory.h>
  58. int _yyread(int fd, char *buf, int size);
  59.  
  60. #define YY_INPUT(buf,result,max_size) \
  61.     if ( (result = _yyread( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  62.         YY_FATAL_ERROR( "read() in flex scanner failed" );
  63. #endif
  64.  
  65.  
  66. #ifndef YY_USE_CONST
  67. #define const
  68. #endif
  69.  
  70.  
  71. #ifdef YY_USE_PROTOS
  72. #define YY_PROTO(proto) proto
  73. #else
  74. #define YY_PROTO(proto) ()
  75. /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
  76.  * so it's got to be a K&R compiler, and therefore there's no standard
  77.  * place from which to include these definitions
  78.  */
  79. char *malloc();
  80. int free();
  81. int read();
  82. #endif
  83.  
  84.  
  85. /* amount of stuff to slurp up with each read */
  86. #ifndef YY_READ_BUF_SIZE
  87. #define YY_READ_BUF_SIZE 8192
  88. #endif
  89.  
  90. /* returned upon end-of-file */
  91. #define YY_END_TOK 0
  92.  
  93. /* copy whatever the last rule matched to the standard output */
  94.  
  95. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  96. /* this used to be an fputs(), but since the string might contain NUL's,
  97.  * we now use fwrite()
  98.  */
  99. #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  100.  
  101. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  102.  * is returned in "result".
  103.  */
  104. #ifndef YY_INPUT
  105. #define YY_INPUT(buf,result,max_size) \
  106.     if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  107.         YY_FATAL_ERROR( "read() in flex scanner failed" );
  108. #endif
  109. #define YY_NULL 0
  110.  
  111. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  112.  * we don't want an extra ';' after the "return" because that will cause
  113.  * some compilers to complain about unreachable statements.
  114.  */
  115. #define yyterminate() return ( YY_NULL )
  116.  
  117. /* report a fatal error */
  118.  
  119. /* The funky do-while is used to turn this macro definition into
  120.  * a single C statement (which needs a semi-colon terminator).
  121.  * This avoids problems with code like:
  122.  *
  123.  *     if ( something_happens )
  124.  *        YY_FATAL_ERROR( "oops, the something happened" );
  125.  *    else
  126.  *        everything_okay();
  127.  *
  128.  * Prior to using the do-while the compiler would get upset at the
  129.  * "else" because it interpreted the "if" statement as being all
  130.  * done when it reached the ';' after the YY_FATAL_ERROR() call.
  131.  */
  132.  
  133. #define YY_FATAL_ERROR(msg) \
  134.     do \
  135.         { \
  136.         (void) fputs( msg, stderr ); \
  137.         (void) putc( '\n', stderr ); \
  138.         exit( 1 ); \
  139.         } \
  140.     while ( 0 )
  141.  
  142. /* default yywrap function - always treat EOF as an EOF */
  143. #define yywrap() 1
  144.  
  145. /* enter a start condition.  This macro really ought to take a parameter,
  146.  * but we do it the disgusting crufty way forced on us by the ()-less
  147.  * definition of BEGIN
  148.  */
  149. #define BEGIN yy_start = 1 + 2 *
  150.  
  151. /* action number for EOF rule of a given start state */
  152. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  153.  
  154. /* special action meaning "start processing a new file" */
  155. #define YY_NEW_FILE \
  156.     do \
  157.         { \
  158.         yy_init_buffer( yy_current_buffer, yyin ); \
  159.         yy_load_buffer_state(); \
  160.         } \
  161.     while ( 0 )
  162.  
  163. /* default declaration of generated scanner - a define so the user can
  164.  * easily add parameters
  165.  */
  166. #define YY_DECL int yylex YY_PROTO(( void )) 
  167.  
  168. /* code executed at the end of each rule */
  169. #define YY_BREAK break;
  170.  
  171. #define YY_END_OF_BUFFER_CHAR 0
  172.  
  173. #ifndef YY_BUF_SIZE
  174. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  175. #endif
  176.  
  177. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  178.  
  179. #define YY_CHAR unsigned char
  180. # line 1 "lacheck.lex"
  181. #define INITIAL 0
  182. # line 2 "lacheck.lex"
  183. /*                    -*- Mode: C -*- 
  184.  * 
  185.  * lacheck.lex - A consistency checker checker for LaTeX documents
  186.  * 
  187.  * Copyright (C) 1991 Kresten Krab Thorup (krab@iesd.auc.dk).
  188.  * 
  189.  * $Locker: krab $
  190.  * $Revision: 1.15 $
  191.  * Author          : Kresten Krab Thorup
  192.  * Created On      : Sun May 26 18:11:58 1991
  193.  * Last Modified By: Kresten Krab Thorup
  194.  * Last Modified On: Sat Jun  6 16:40:19 1992
  195.  * Update Count    : 51
  196.  * 
  197.  * HISTORY
  198.  * 6-Jun-1992        Kresten Krab Thorup    
  199.  *    Last Modified: Sat Jun  6 16:37:44 1992 #48 (Kresten Krab Thorup)
  200.  *    Added test for whitespace before punctation mark
  201.  * 17-Dec-1991  (Last Mod: Tue Dec 17 21:01:24 1991 #41)  Kresten Krab Thorup
  202.  *    Added 'word word` and missing ~ before cite and ref
  203.  * 18-Jun-1991  (Last Mod: Tue Jun 18 19:20:43 1991 #17)  Kresten Krab Thorup
  204.  *    Added check (or rather management) for \newenvironment and
  205.  *    \newcommand - as suggested by Per Abrahamsen abrham@hugin.dk
  206.  * 30-May-1991  (Last Mod: Thu May 30 02:22:33 1991 #15)  Kresten Krab Thorup
  207.  *    Added check for `$${punct}' and `{punct}$' constructions
  208.  * 30-May-1991  (Last Mod: Wed May 29 10:31:35 1991 #6)  Kresten Krab Thorup
  209.  *    Improved (dynamic) stack management from Andreas Stolcke ...
  210.  *                                       <stolcke@ICSI.Berkeley.EDU> 
  211.  * 26-May-1991  Kresten Krab Thorup
  212.  *    Initial distribution version.
  213.  */
  214.  
  215. /* * Last edited: Jun  6 16:40 1992 (krab) */
  216.  
  217. #include <stdio.h>
  218. #include <string.h>
  219. #include <sys/param.h>
  220.  
  221. /* extern char *realloc(); */ /* mj - don't declare - this is in headers */
  222.  
  223. #ifdef NEED_STRSTR
  224. char *strstr(char *, char*);  /* mj - provide prototype in case if needed */
  225. #endif
  226.  
  227. #define GROUP_STACK_SIZE 10
  228. #define INPUT_STACK_SIZE 10
  229.  
  230. #define PROGNAME "LaCheck"
  231.  
  232.   /* macros */
  233.  
  234. #define CG_NAME gstack[gstackp-1].s_name
  235. #define CG_TYPE gstack[gstackp-1].s_type
  236. #define CG_LINE gstack[gstackp-1].s_line
  237. #define CG_FILE gstack[gstackp-1].s_file
  238.  
  239. char *bg_command();
  240. void pop();
  241. void push();
  242. void g_checkend();
  243. void e_checkend();
  244. void f_checkend();
  245. void input_file();
  246. void print_bad_match();
  247. int check_top_level_end();
  248.  
  249.   /* global variables */
  250.  
  251. char returnval[100];
  252. int line_count = 1;
  253. int warn_count = 0;
  254. char *file_name;
  255. char verb_char;
  256.  
  257.   /* the group stack */
  258.  
  259. typedef struct tex_group 
  260.  {
  261.     unsigned char *s_name;
  262.     int s_type;
  263.     int s_line;
  264.     char *s_file; 
  265.  } tex_group;
  266.  
  267. tex_group *gstack;
  268. int gstack_size = GROUP_STACK_SIZE;
  269. int gstackp = 0;
  270.  
  271. typedef struct input_ 
  272.  {
  273.     YY_BUFFER_STATE stream;
  274.     char *name;
  275.     int linenum;
  276.  } input_;
  277.  
  278. input_ *istack;
  279. int istack_size = INPUT_STACK_SIZE;
  280. int istackp = 0;
  281.  
  282. int def_count = 0;
  283.  
  284. #define B_ENVIRONMENT 1
  285. #define E_ENVIRONMENT 2
  286. #define VERBATIM 3
  287. #define INCLUDE 4
  288. #define MATH 5
  289. #define COMMENT 6
  290. #define VERB 7
  291. #define DEF 8
  292. #define AFTER_DISPLAY 9
  293. #define ENV_DEF 10
  294. # line 144 "lacheck.lex"
  295.  
  296. /* done after the current pattern has been matched and before the
  297.  * corresponding action - sets up yytext
  298.  */
  299. #define YY_DO_BEFORE_ACTION \
  300.     yytext = yy_bp; \
  301.     yyleng = yy_cp - yy_bp; \
  302.     yy_hold_char = *yy_cp; \
  303.     *yy_cp = '\0'; \
  304.     yy_c_buf_p = yy_cp;
  305.  
  306. #define EOB_ACT_CONTINUE_SCAN 0
  307. #define EOB_ACT_END_OF_FILE 1
  308. #define EOB_ACT_LAST_MATCH 2
  309.  
  310. /* return all but the first 'n' matched characters back to the input stream */
  311. #define yyless(n) \
  312.     do \
  313.         { \
  314.         /* undo effects of setting up yytext */ \
  315.         *yy_cp = yy_hold_char; \
  316.         yy_c_buf_p = yy_cp = yy_bp + n; \
  317.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  318.         } \
  319.     while ( 0 )
  320.  
  321. #define unput(c) yyunput( c, yytext )
  322.  
  323.  
  324. struct yy_buffer_state
  325.     {
  326.     FILE *yy_input_file;
  327.  
  328.     YY_CHAR *yy_ch_buf;        /* input buffer */
  329.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  330.  
  331.     /* size of input buffer in bytes, not including room for EOB characters*/
  332.     int yy_buf_size;    
  333.  
  334.     /* number of characters read into yy_ch_buf, not including EOB characters */
  335.     int yy_n_chars;
  336.  
  337.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  338. #define EOF_NOT_SEEN 0
  339.     /* "pending" happens when the EOF has been seen but there's still
  340.      * some text process
  341.      */
  342. #define EOF_PENDING 1
  343. #define EOF_DONE 2
  344.     };
  345.  
  346. static YY_BUFFER_STATE yy_current_buffer;
  347.  
  348. /* we provide macros for accessing buffer states in case in the
  349.  * future we want to put the buffer states in a more general
  350.  * "scanner state"
  351.  */
  352. #define YY_CURRENT_BUFFER yy_current_buffer
  353.  
  354.  
  355. /* yy_hold_char holds the character lost when yytext is formed */
  356. static YY_CHAR yy_hold_char;
  357.  
  358. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  359.  
  360.  
  361.  
  362. #ifndef YY_USER_ACTION
  363. #define YY_USER_ACTION
  364. #endif
  365.  
  366. #ifndef YY_USER_INIT
  367. #define YY_USER_INIT
  368. #endif
  369.  
  370. extern YY_CHAR *yytext;
  371. extern int yyleng;
  372. extern FILE *yyin, *yyout;
  373.  
  374. YY_CHAR *yytext;
  375. int yyleng;
  376.  
  377. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  378.  
  379. #define YY_END_OF_BUFFER 66
  380. typedef int yy_state_type;
  381. static const short int yy_acclist[204] =
  382.     {   0,
  383.        66,   64,   65,   64,   65,    4,   65,   64,   65,   64,
  384.        65,   26,   64,   65,    3,   58,   64,   65,   64,   65,
  385.        64,   65,   64,   65,   64,   65,   64,   65,   64,   65,
  386.        64,   65,    8,   64,   65,    9,   64,   65,   64,   65,
  387.        32,   65,   65,   41,   65,   35,   65,   34,   35,   65,
  388.        36,   65,   35,   65,   62,   65,   60,   65,   59,   65,
  389.        38,   65,   13,   65,    4,   65,    3,   13,   65,   13,
  390.        65,   11,   13,   65,   12,   13,   65,   23,   65,   24,
  391.        65,   22,   23,   65,   17,   65,    3,   17,   65,   17,
  392.        65,   15,   17,   65,   16,   17,   65,   57,   46,   25,
  393.  
  394.        27,    3,    3,    7,    2,   18,   19,   20,    1,   21,
  395.         5,    6,16427,   46,   32,   41,   62,16426,    3,    3,
  396.         3,   49,   51,16429,   54,   54,   54,16437,16428,    3,
  397.         3,    3,    3,    3,    3,    3,   54,   54, 8245, 8235,
  398.        50,   50, 8234,    3,    3,   50,    3,    3,   50,    3,
  399.         3, 8237,   10,   10,   54,   10,   40,   39, 8236,    3,
  400.        10,   54,   10,   54,   37,   37,   54,   37,    3,   31,
  401.        30,    8,    9,   61,   11,   12,   15,   16,   52,    3,
  402.        47,    3,    3,    3,   56,   48,   48,   55,    3,   48,
  403.         3,    3,   48,    3,   29,   29,   54,16427,   28,   28,
  404.  
  405.        54,   33,   14
  406.     } ;
  407.  
  408. static const short int yy_accept[516] =
  409.     {   0,
  410.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  411.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  412.         1,    1,    1,    2,    4,    6,    8,   10,   12,   15,
  413.        19,   21,   23,   25,   27,   29,   31,   33,   36,   39,
  414.        41,   43,   44,   46,   48,   51,   53,   55,   57,   59,
  415.        61,   63,   65,   67,   70,   72,   75,   78,   80,   82,
  416.        85,   87,   90,   92,   95,   98,   98,   98,   99,   99,
  417.        99,   99,   99,   99,  100,  100,  101,  101,  102,  103,
  418.       104,  104,  104,  104,  104,  104,  105,  106,  107,  108,
  419.       108,  108,  109,  110,  111,  111,  111,  111,  111,  111,
  420.  
  421.       111,  111,  111,  111,  111,  111,  111,  111,  112,  113,
  422.       114,  114,  114,  115,  115,  116,  117,  117,  118,  118,
  423.       118,  118,  118,  118,  118,  118,  118,  118,  118,  118,
  424.       119,  119,  119,  119,  119,  120,  121,  122,  122,  122,
  425.       123,  123,  123,  123,  124,  125,  126,  127,  128,  128,
  426.       129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
  427.       129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
  428.       129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
  429.       129,  129,  129,  129,  129,  129,  130,  130,  130,  130,
  430.       130,  130,  130,  130,  130,  130,  131,  132,  133,  134,
  431.  
  432.       135,  136,  137,  137,  137,  137,  137,  137,  137,  137,
  433.       137,  137,  138,  139,  139,  139,  140,  140,  140,  140,
  434.       140,  140,  140,  140,  140,  140,  140,  140,  140,  140,
  435.       140,  140,  140,  140,  140,  141,  141,  141,  141,  141,
  436.       141,  141,  141,  141,  141,  141,  141,  141,  142,  142,
  437.       143,  143,  143,  143,  143,  143,  143,  143,  143,  143,
  438.       144,  144,  144,  144,  144,  144,  145,  147,  148,  150,
  439.       151,  152,  152,  152,  152,  152,  152,  152,  152,  152,
  440.       153,  153,  153,  153,  153,  154,  156,  157,  157,  157,
  441.       158,  158,  159,  159,  159,  159,  159,  159,  159,  159,
  442.  
  443.       159,  159,  159,  159,  159,  159,  159,  159,  159,  159,
  444.       159,  159,  159,  159,  159,  159,  159,  159,  159,  159,
  445.       160,  160,  160,  160,  160,  160,  160,  160,  160,  161,
  446.       161,  161,  161,  161,  161,  161,  161,  161,  163,  165,
  447.       165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
  448.       166,  168,  169,  169,  169,  169,  169,  169,  169,  169,
  449.       169,  169,  169,  169,  169,  169,  169,  169,  169,  169,
  450.       170,  170,  170,  170,  170,  170,  171,  171,  172,  173,
  451.       174,  174,  174,  175,  175,  175,  175,  175,  175,  175,
  452.       175,  175,  175,  176,  177,  178,  179,  179,  180,  180,
  453.  
  454.       180,  180,  180,  181,  181,  181,  182,  182,  182,  182,
  455.       182,  182,  182,  182,  182,  182,  182,  182,  182,  182,
  456.       182,  182,  182,  182,  183,  184,  185,  185,  185,  185,
  457.       185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
  458.       186,  186,  186,  186,  186,  187,  187,  188,  188,  188,
  459.       188,  188,  189,  191,  192,  194,  195,  195,  195,  195,
  460.       195,  195,  195,  196,  198,  198,  198,  198,  198,  198,
  461.       199,  199,  199,  199,  199,  199,  199,  199,  199,  199,
  462.       199,  199,  199,  199,  199,  199,  199,  199,  199,  199,
  463.       200,  202,  202,  202,  202,  202,  202,  202,  202,  202,
  464.  
  465.       202,  202,  202,  203,  203,  203,  203,  203,  203,  203,
  466.       203,  203,  203,  204,  204
  467.     } ;
  468.  
  469. static const YY_CHAR yy_ec[256] =
  470.     {   0,
  471.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  472.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  473.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  474.         1,    4,    5,    1,    1,    6,    7,    1,    8,    9,
  475.        10,    1,   11,   12,   13,   14,    1,    1,    1,    1,
  476.         1,    1,    1,    1,    1,    1,    1,   15,   16,    1,
  477.         1,    1,    5,   17,   18,   18,   18,   18,   18,   18,
  478.        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  479.        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
  480.        19,   20,   21,    1,   22,   23,   24,   25,   26,   27,
  481.  
  482.        28,   29,   30,   31,   32,   33,   33,   34,   35,   36,
  483.        37,   38,   33,   39,   40,   41,   42,   43,   44,   45,
  484.        33,   33,   46,    1,   47,   48,    1,    1,    1,    1,
  485.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  486.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  487.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  488.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  489.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  490.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  491.         1,    1,    1,    1,    1,    1,   49,   49,    1,    1,
  492.  
  493.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  494.         1,    1,    1,    1,    1,   49,    1,    1,    1,    1,
  495.         1,    1,    1,    1,    1,    1,    1,    1,   50,   50,
  496.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  497.         1,    1,    1,    1,    1,    1,    1,   50,    1,    1,
  498.         1,    1,    1,    1,    1
  499.     } ;
  500.  
  501. static const YY_CHAR yy_meta[51] =
  502.     {   0,
  503.         1,    2,    3,    2,    4,    1,    1,    1,    1,    1,
  504.         1,    4,    1,    4,    1,    1,    5,    6,    1,    4,
  505.         1,    1,    7,    8,    8,    8,    8,    8,    8,    8,
  506.         8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
  507.         8,    8,    8,    8,    8,    9,   10,    4,    4,   11
  508.     } ;
  509.  
  510. static const short int yy_base[544] =
  511.     {   0,
  512.         0,    0,   48,   49,   50,   51,   53,   55,   56,   57,
  513.         0,    0, 1519, 1518, 1517, 1516,   59,   61,   58,   62,
  514.        67,   79, 1518, 1505,  125,  173, 1508,   65,   72, 1503,
  515.        98,  103,   71,  217,   76,  110,  119, 1502, 1501,  132,
  516.         0, 1523,    0, 1523, 1523, 1523, 1484,    0, 1523, 1523,
  517.      1523, 1523, 1523,    0,  135, 1523, 1523, 1523, 1523, 1523,
  518.      1523,    0,  143, 1523, 1523,  144,  151, 1523,   62,  144,
  519.      1497,  135,  147, 1523,  154, 1523, 1500, 1523,    0,  196,
  520.       199,  263,  256, 1495,  190, 1523, 1523, 1523, 1523, 1491,
  521.      1490, 1523, 1523, 1523,  200,  252,  123,  258,  264,  256,
  522.  
  523.       169,  177,  261,  263,  267,  272,  192, 1523, 1523,  304,
  524.      1472, 1471, 1523, 1464,    0,    0, 1467,    0, 1472, 1471,
  525.      1470, 1469,  307,  312,  308,  323, 1466, 1469, 1458,   89,
  526.      1461, 1460, 1471, 1470,  315,  340,  333,  152,  353, 1523,
  527.       353,  372, 1464, 1523,  229, 1473, 1472, 1471,  162,  376,
  528.        77,  313,  189,  286,  334,  335,  365,  269,  295,  314,
  529.       104,  208,  316,  353,  319,  381,  393, 1473,  273,  367,
  530.      1458, 1457, 1446, 1456, 1443, 1442, 1441, 1440,  357, 1466,
  531.       396,  403,  397,  416, 1450,  422, 1435, 1446, 1450,  425,
  532.       429, 1445, 1444, 1437, 1436,  390, 1457,  435,  438,  445,
  533.  
  534.       442, 1441, 1433,  452,  464, 1439,  410, 1433, 1427,  467,
  535.       472, 1446, 1445,  370,  476, 1523,  384,  432,  522,  397,
  536.       571,  437,  462,  447,  465,  466,  418,  469,  470,  474,
  537.       471,  476,  500,  504, 1523,  510, 1427, 1426, 1418, 1417,
  538.      1433,  574, 1419, 1418, 1417, 1416, 1426, 1523,  497, 1439,
  539.       577, 1413,  580,  585, 1421, 1402, 1421,  516,  588, 1523,
  540.       591, 1405, 1404, 1416, 1415, 1416,    0,  565, 1429,  602,
  541.      1403,  570, 1402, 1404, 1405, 1401, 1394,  606,  598, 1523,
  542.       610,  582,  596,  623,  643,  672,    0,  602,  646, 1523,
  543.       606, 1523,  604,  614,  598,  615,  478,  616,  618,  624,
  544.  
  545.       634,  637,  678,  718,  767, 1406, 1405, 1391, 1390, 1404,
  546.       770, 1386, 1386, 1385, 1384, 1383, 1383,  773,  776, 1523,
  547.       777,    0, 1395,  780, 1381, 1380, 1379, 1378, 1377, 1376,
  548.      1374, 1380, 1386, 1373,  783,  794,  769,    0,    0,  771,
  549.       629,  636,  788,  776,  782,  772,  785,  783,  810, 1523,
  550.      1393, 1383, 1356, 1355, 1342, 1331, 1330, 1328, 1317, 1316,
  551.      1315, 1311, 1308,  802, 1299, 1317, 1316, 1302, 1298, 1273,
  552.      1272, 1282, 1269,  833,  839, 1523,  619, 1523, 1291, 1290,
  553.       786,  793, 1523,  791,  812,  801,  821, 1262, 1258, 1256,
  554.      1249, 1245, 1523, 1523, 1523, 1523,  846, 1523, 1238, 1234,
  555.  
  556.      1238, 1227,  852, 1211,  860, 1523,  853,  822,  840,  853,
  557.       828,  843,  857, 1222, 1220,  853, 1221, 1119,  889,  884,
  558.       908, 1091, 1090, 1116,  903,  902,  864,  927, 1100,  653,
  559.      1093,  866,  957,  880,  885,  887,  908, 1085, 1084, 1523,
  560.      1107,  913,  919, 1095, 1523,  924, 1106, 1006,  997,  923,
  561.       929,  912,    0, 1009, 1105, 1012,  987, 1079, 1081, 1081,
  562.      1077,  917, 1523, 1093, 1001,  922, 1000, 1002, 1000, 1041,
  563.      1068, 1074, 1073, 1063,  995, 1000,  997, 1045, 1010, 1079,
  564.      1013, 1083, 1084,  990,  992,  925,  912,  920,  863, 1523,
  565.       872, 1082, 1083,  851,  732,  680,  653, 1084,  539,  469,
  566.  
  567.       457, 1085, 1523,  415,  254, 1086,  173,  172,    0,  105,
  568.        22,    0,    0, 1523, 1132, 1143, 1154, 1165, 1176, 1187,
  569.      1198, 1209, 1220, 1231, 1241, 1252, 1263, 1274, 1285, 1292,
  570.      1296, 1303, 1314, 1325, 1332, 1339, 1349, 1360, 1371, 1382,
  571.      1387, 1393, 1401
  572.     } ;
  573.  
  574. static const short int yy_def[544] =
  575.     {   0,
  576.       514,    1,  515,  515,  516,  516,  517,  517,  518,  518,
  577.       519,  519,  520,  520,  521,  521,  522,  522,  523,  523,
  578.       524,  524,  514,  514,  525,  525,   26,  514,  514,  526,
  579.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  580.       527,  514,  528,  514,  514,  514,  514,  529,  514,  514,
  581.       514,  514,  514,  526,  514,  514,  514,  514,  514,  514,
  582.       514,  526,  514,  514,  514,  514,  514,  514,  514,  514,
  583.       514,  514,  514,  514,  514,  514,  514,  514,  526,  526,
  584.       514,  514,  514,  514,  514,  514,  514,  514,  514,  530,
  585.       531,  514,  514,  514,  531,  531,  531,  531,  531,  531,
  586.  
  587.       531,  531,  531,  531,  531,  531,  531,  514,  514,  532,
  588.       514,  514,  514,  514,  527,  528,  514,  529,  514,  514,
  589.       514,  514,  514,  533,  514,  514,  514,  514,  514,  514,
  590.       514,  514,  514,  514,  526,  534,  526,  514,  514,  514,
  591.       514,  514,  514,  514,  514,  535,  530,  535,  531,  531,
  592.       531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
  593.       531,  531,  531,  531,  531,  536,  536,  514,  514,  514,
  594.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  595.       533,  533,  514,  514,  514,  514,  514,  514,  514,  537,
  596.       537,  514,  514,  514,  514,  526,  526,  534,  534,  526,
  597.  
  598.       526,  526,  514,  514,  514,  514,  514,  514,  514,  514,
  599.       514,  535,  535,  531,  514,  514,  531,  531,  514,  531,
  600.       531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
  601.       531,  531,  536,  536,  514,  536,  514,  514,  514,  514,
  602.       514,  514,  514,  514,  514,  514,  514,  514,  533,  514,
  603.       533,  514,  514,  514,  514,  514,  514,  537,  537,  514,
  604.       537,  514,  514,  514,  514,  526,  526,  534,  526,  534,
  605.       526,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  606.       514,  531,  531,  531,  219,  219,  219,  531,  514,  514,
  607.       531,  514,  531,  531,  531,  531,  531,  531,  531,  531,
  608.  
  609.       531,  531,  531,  514,  536,  514,  514,  514,  514,  514,
  610.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  611.       514,  538,  514,  537,  514,  514,  514,  514,  526,  514,
  612.       514,  514,  514,  514,  514,  221,  531,  286,  286,  531,
  613.       531,  531,  531,  531,  531,  531,  531,  531,  531,  514,
  614.       535,  531,  514,  514,  514,  514,  514,  514,  514,  514,
  615.       514,  514,  514,  514,  538,  514,  514,  514,  514,  526,
  616.       514,  514,  514,  514,  514,  514,  531,  514,  531,  531,
  617.       531,  531,  514,  531,  531,  531,  531,  514,  514,  514,
  618.       514,  514,  514,  514,  514,  514,  539,  514,  514,  514,
  619.  
  620.       514,  514,  540,  514,  514,  514,  514,  531,  531,  531,
  621.       531,  531,  531,  514,  514,  541,  514,  514,  539,  514,
  622.        26,  514,  514,  526,  540,  526,  514,  514,  514,  514,
  623.       514,  531,  514,  531,  531,  531,  531,  514,  514,  514,
  624.       514,  514,  514,  514,  514,  539,  514,  539,  421,  514,
  625.       514,  514,  526,  540,  526,  540,  514,  514,  514,  514,
  626.       514,  531,  514,  535,  531,  531,  531,  531,  541,  514,
  627.       514,  514,  514,  514,  514,  514,  514,  514,  531,  531,
  628.       531,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  629.       535,  531,  531,  514,  514,  514,  514,  531,  514,  514,
  630.  
  631.       514,  531,  514,  514,  514,  531,  514,  514,  542,  421,
  632.       542,  543,  543,    0,  514,  514,  514,  514,  514,  514,
  633.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  634.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  635.       514,  514,  514
  636.     } ;
  637.  
  638. static const short int yy_nxt[1574] =
  639.     {   0,
  640.        24,   25,   26,   27,   28,   29,   30,   24,   24,   24,
  641.        31,   24,   31,   32,   24,   24,   24,   33,   24,   34,
  642.        24,   24,   24,   35,   35,   35,   35,   35,   35,   35,
  643.        35,   35,   35,   36,   35,   35,   35,   35,   35,   35,
  644.        35,   37,   35,   35,   35,   38,   39,   40,   33,   35,
  645.        42,   42,   42,   42,   45,   46,   45,   46,   42,   42,
  646.        59,   53,   60,   53,   59,   54,   60,   54,  512,   53,
  647.        76,   60,   47,   62,   47,   60,   66,   78,   55,  126,
  648.        55,   53,   66,   66,   77,   62,   63,   66,   85,  110,
  649.       190,  191,  190,  148,   42,   42,   42,   42,   63,   81,
  650.  
  651.        81,   81,   42,   42,   56,   57,   56,   57,   76,   66,
  652.       126,   82,   64,   65,   66,  217,   84,   83,  514,   85,
  653.       148,   66,   77,  110,   64,   65,   67,   67,   67,   68,
  654.        66,  111,  110,  113,  113,  113,   66,  228,   68,  148,
  655.       112,   87,   69,   66,   70,  123,  123,  123,  130,   87,
  656.       153,  114,   67,   67,   67,   68,  131,  124,   72,  119,
  657.       130,   75,  120,  125,   68,   82,   73,  121,  132,  127,
  658.       122,  203,   74,   69,   67,   67,   67,   68,  148,   74,
  659.       108,  109,  128,  129,   66,  148,   68,  133,  108,  109,
  660.        69,  214,   70,  148,  145,  134,  158,  135,  123,  135,
  661.  
  662.       138,  138,  138,  145,  159,  148,   72,   85,  148,  136,
  663.       510,  510,   82,  160,   73,  137,  148,  219,   83,  165,
  664.        74,   69,   86,   87,  148,   88,   89,  149,  150,  151,
  665.       210,  211,  210,   90,   91,   92,   93,   94,   85,  229,
  666.        91,   95,   96,   97,   98,   91,   99,   91,  100,   91,
  667.        91,  101,  102,  103,   91,  104,  105,  106,   91,  107,
  668.        91,   99,  108,  109,  139,  139,  139,  142,  148,  142,
  669.       142,  142,  148,  140,  148,  140,   82,  148,  152,  148,
  670.       148,  508,  141,  148,   97,  148,  110,  154,  148,  143,
  671.        97,  157,  150,  155,  237,  225,  150,  150,  161,  156,
  672.  
  673.       150,  162,  148,  164,  163,  166,  167,  166,  179,  179,
  674.       179,  148,  150,  181,  181,  181,  196,  179,  196,  184,
  675.       124,  184,  184,  184,  220,  182,  125,  186,  136,  148,
  676.       148,  183,  148,  185,  137,  148,  186,  169,  226,  230,
  677.       126,  198,  181,  198,  201,  170,  201,  201,  201,  218,
  678.       148,  148,  227,  199,  204,  204,  204,  232,  202,  200,
  679.       221,  222,  222,  140,  205,  140,  205,  205,  205,  148,
  680.       124,  126,  141,  138,  138,  138,  247,  215,  206,  215,
  681.       110,  148,  233,  234,  233,   82,  148,  231,  238,  207,
  682.       223,   83,  148,  208,  236,  167,  236,  249,  249,  249,
  683.  
  684.       148,  282,  224,  136,  181,  181,  181,  250,  251,  266,
  685.       251,  251,  251,  148,  250,  183,  182,  179,  179,  179,
  686.       283,  216,  183,  253,  254,  253,  258,  259,  258,  124,
  687.       261,  191,  261,  288,  148,  125,  268,  249,  268,  198,
  688.       181,  198,  507,  196,  179,  196,  269,  274,  148,  269,
  689.       275,  199,  299,  148,  200,  136,  270,  200,  270,  270,
  690.       270,  137,  140,  148,  140,  204,  204,  204,  278,  279,
  691.       278,  272,  284,  281,  140,  281,  140,  215,  148,  215,
  692.       293,  148,  148,  141,  280,  148,  148,  148,  295,  280,
  693.       148,  297,  148,  298,  148,  294,  296,  505,  303,  302,
  694.  
  695.       304,  233,  234,  233,  301,  305,  167,  305,  250,  504,
  696.       300,  305,  234,  305,  345,  280,  514,  258,  259,  258,
  697.       280,  216,  285,  285,  285,  285,  285,  285,  285,  285,
  698.       285,  285,  285,  285,  285,  285,  285,  285,  286,  287,
  699.       285,  285,  285,  285,  285,  287,  287,  287,  287,  287,
  700.       287,  287,  287,  287,  287,  287,  287,  287,  287,  287,
  701.       287,  287,  287,  287,  287,  287,  287,  180,  285,  285,
  702.       285,  285,  289,  290,  289,  311,  269,  311,  249,  249,
  703.       249,  318,  319,  318,   79,  503,  321,  148,  321,  324,
  704.       191,  324,  324,  259,  324,  206,  183,  320,  148,  335,
  705.  
  706.       291,  335,  320,  268,  249,  268,  207,  278,  279,  278,
  707.       208,  281,  148,  281,  148,  280,  292,  336,  148,  312,
  708.       148,  200,  148,  280,   81,   81,   81,  280,  320,  297,
  709.       148,  148,  148,  320,  148,  148,   82,  337,  343,  148,
  710.       148,  347,   83,  340,  341,  148,  280,  289,  290,  289,
  711.       148,  346,  148,  148,  280,  342,  344,  408,  280,  285,
  712.       285,  348,  382,  284,  349,  381,  285,  285,  285,  285,
  713.       285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
  714.       285,  285,  285,  285,  285,  285,  285,  285,  338,  339,
  715.       459,  292,  406,  460,  148,  339,  339,  339,  339,  339,
  716.  
  717.       339,  339,  339,  339,  339,  339,  339,  339,  339,  339,
  718.       339,  339,  339,  339,  339,  339,  339,  284,  350,  350,
  719.       501,  350,  350,  350,  350,  350,  350,  350,  350,  350,
  720.       350,  350,  350,  350,  351,  352,  350,  350,  350,  350,
  721.       350,  352,  352,  352,  352,  352,  352,  352,  352,  352,
  722.       352,  352,  352,  352,  352,  352,  352,  352,  352,  352,
  723.       352,  352,  352,  350,  350,  350,  350,  350,  305,  234,
  724.       305,  311,  500,  311,  318,  319,  318,  364,  321,  364,
  725.       321,  324,  259,  324,  335,  148,  335,  148,  148,  383,
  726.       320,  383,  148,  320,  320,  375,  376,  375,  148,  148,
  727.  
  728.       280,  148,  148,  364,  148,  364,  379,  148,  380,  148,
  729.       384,  113,  113,  113,  386,  312,  385,  148,  387,  320,
  730.       343,  320,  284,  377,  320,  320,  148,  409,  148,  114,
  731.       410,  280,  412,  383,  405,  405,  405,  148,  148,  378,
  732.       375,  376,  375,  406,  148,  406,  411,  419,  419,  419,
  733.       320,  435,  407,  425,  419,  425,  148,   74,  432,  148,
  734.       413,  427,  427,  427,  428,  420,  428,  428,  428,  148,
  735.       406,  426,  406,  148,  406,  440,  406,  433,  429,  407,
  736.       434,  436,  148,  457,  378,  499,  442,  437,  212,  430,
  737.       446,  446,  446,  431,  443,  448,  148,  448,  448,  448,
  738.  
  739.       447,  148,  406,  148,  454,  446,  454,  462,  420,  514,
  740.       514,  514,  514,  456,  455,  456,  456,  456,  465,  514,
  741.       466,  449,  426,  467,  148,  514,  470,  514,  427,  427,
  742.       427,  468,  470,  148,  111,  447,  130,  406,  148,  406,
  743.       112,  450,  130,  514,  472,  133,  407,  497,  219,  451,
  744.       473,  406,  496,  134,  478,  514,  514,  463,  463,  463,
  745.       463,  463,  463,  463,  463,  463,  463,  463,  463,  463,
  746.       463,  463,  463,  464,   91,  463,  463,  463,  463,  463,
  747.        91,   91,   91,   91,   91,   91,   91,   91,   91,   91,
  748.        91,   91,   91,   91,   91,   91,   91,   91,   91,   91,
  749.  
  750.        91,   91,  463,  463,  463,  463,  463,  446,  446,  446,
  751.       514,  418,  429,  454,  446,  454,  148,  148,  148,  495,
  752.       455,  494,  514,  430,  489,  420,  148,  431,   79,  148,
  753.        72,  426,  479,  482,  488,  480,  487,  492,   73,  481,
  754.       150,  483,  166,  167,  166,  490,  490,  490,  490,  490,
  755.       490,  490,  490,  490,  490,  490,  490,  490,  490,  490,
  756.       490,  491,   91,  490,  490,  490,  490,  490,   91,   91,
  757.        91,   91,   91,   91,   91,   91,   91,   91,   91,   91,
  758.        91,   91,   91,   91,   91,   91,   91,   91,   91,   91,
  759.       490,  490,  490,  490,  490,  148,  470,  470,  148,  148,
  760.  
  761.       148,  148,  148,  406,  237,  238,  486,  485,  484,  212,
  762.       498,  477,  476,  493,  475,  474,  453,  445,  471,  502,
  763.       470,  150,  469,  469,  461,  506,  458,  453,  452,  452,
  764.       445,  509,   41,   41,   41,   41,   41,   41,   41,   41,
  765.        41,   41,   41,   43,   43,   43,   43,   43,   43,   43,
  766.        43,   43,   43,   43,   44,   44,   44,   44,   44,   44,
  767.        44,   44,   44,   44,   44,   48,   48,   48,   48,   48,
  768.        48,   48,   48,   48,   48,   48,   42,   42,   42,   42,
  769.        42,   42,   42,   42,   42,   42,   42,   49,   49,   49,
  770.        49,   49,   49,   49,   49,   49,   49,   49,   51,   51,
  771.  
  772.        51,   51,   51,   51,   51,   51,   51,   51,   51,   52,
  773.        52,   52,   52,   52,   52,   52,   52,   52,   52,   52,
  774.        58,   58,   58,   58,   58,   58,   58,   58,   58,   58,
  775.        58,   61,   61,   61,   61,   61,   61,   61,   61,   61,
  776.        61,   61,   71,   71,   71,  444,   71,  439,   71,  438,
  777.       140,   71,   79,   79,  423,   79,   79,   79,   79,   79,
  778.        79,   79,   79,  115,  115,  422,  115,  115,  115,  115,
  779.       115,  115,  421,  115,  116,  116,  421,  116,  116,  116,
  780.       116,  116,  116,  417,  116,  118,  118,  416,  118,  118,
  781.       118,  118,  118,  118,  416,  118,  147,  147,  415,  147,
  782.  
  783.        91,   91,  414,   91,  168,  168,  148,  148,  140,  404,
  784.       168,  140,  403,  168,  180,  180,  180,  180,  180,  180,
  785.       180,  180,  180,  180,  180,  197,  197,  197,  197,  197,
  786.       197,  197,  197,  197,  197,  197,  213,  213,  402,  213,
  787.       235,  235,  401,  400,  399,  398,  235,  397,  396,  235,
  788.       260,  260,  395,  394,  393,  392,  260,   74,  391,  260,
  789.       365,  365,  365,  365,  365,  365,  365,  365,  365,  390,
  790.       365,  418,  418,  418,  418,  418,  418,  418,  418,  418,
  791.       418,  418,  424,  424,  424,  424,  424,  424,  424,  424,
  792.       424,  424,  424,  441,  441,  389,  388,  441,  511,  148,
  793.  
  794.       511,  513,  513,  513,  513,  513,  513,  513,  513,  212,
  795.       513,  513,  374,  373,  372,  371,  140,  370,  369,  368,
  796.       367,  366,   74,  363,  362,  361,  360,  359,  358,  357,
  797.       356,  355,  354,  353,  334,  333,  332,  331,  330,  329,
  798.       267,  202,  328,  327,  326,  325,  323,  322,  256,  317,
  799.       248,  185,  316,  315,  314,  313,  310,  309,  308,  307,
  800.       306,  212,  212,  277,  276,  273,  143,  271,  267,  265,
  801.       264,  263,  262,  257,  256,  255,  252,  248,  246,  245,
  802.       244,  243,  242,  241,  240,  239,  110,  212,  146,  212,
  803.       209,  195,  194,  193,  192,  189,  188,  187,  178,  177,
  804.  
  805.       176,  175,  174,  173,  172,  171,  148,  146,  144,   76,
  806.       130,  117,   66,   66,   80,   75,   66,  514,   42,   42,
  807.        50,   50,   23,  514,  514,  514,  514,  514,  514,  514,
  808.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  809.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  810.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  811.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  812.       514,  514,  514
  813.     } ;
  814.  
  815. static const short int yy_chk[1574] =
  816.     {   0,
  817.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  818.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  819.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  820.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  821.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  822.         3,    4,    5,    6,    7,    7,    8,    8,    9,   10,
  823.        19,   17,   19,   18,   20,   17,   20,   18,  511,   21,
  824.        28,   19,    7,   21,    8,   20,   28,   29,   17,   69,
  825.        18,   22,   33,   29,   28,   22,   21,   35,   33,   35,
  826.       130,  130,  130,  151,    3,    4,    5,    6,   22,   31,
  827.  
  828.        31,   31,    9,   10,   17,   17,   18,   18,   32,   31,
  829.        69,   31,   21,   21,   32,  151,   32,   31,  510,   33,
  830.       161,   36,   32,   36,   22,   22,   25,   25,   25,   25,
  831.        37,   36,   37,   40,   40,   40,   25,  161,   25,   97,
  832.        37,   55,   25,   40,   25,   66,   66,   66,   72,   63,
  833.        97,   40,   67,   67,   67,   67,   72,   66,   25,   55,
  834.        73,   75,   55,   66,   67,  138,   25,   63,   73,   70,
  835.        63,  138,   25,   25,   26,   26,   26,   26,  149,   40,
  836.        55,   55,   70,   70,   26,  101,   26,   75,   63,   63,
  837.        26,  149,   26,  102,   85,   75,  101,   80,   80,   80,
  838.  
  839.        81,   81,   81,   85,  102,  153,   26,   85,  107,   80,
  840.       508,  507,   81,  102,   26,   80,   95,  153,   81,  107,
  841.        26,   26,   34,   34,  162,   34,   34,   95,   95,   95,
  842.       145,  145,  145,   34,   34,   34,   34,   34,   85,  162,
  843.        34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
  844.        34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
  845.        34,   34,   34,   34,   82,   82,   82,   83,   96,   83,
  846.        83,   83,  100,   82,   98,   82,   82,  103,   96,  104,
  847.        99,  505,   82,  105,   98,  158,  169,   98,  106,   83,
  848.        99,  100,   98,   98,  169,  158,  100,  104,  103,   99,
  849.  
  850.       105,  103,  154,  106,  105,  110,  110,  110,  123,  123,
  851.       123,  159,  106,  124,  124,  124,  135,  135,  135,  125,
  852.       123,  125,  125,  125,  154,  124,  123,  126,  135,  152,
  853.       160,  124,  163,  125,  135,  165,  126,  110,  159,  163,
  854.       126,  136,  136,  136,  137,  110,  137,  137,  137,  152,
  855.       155,  156,  160,  136,  139,  139,  139,  165,  137,  136,
  856.       155,  155,  156,  139,  141,  139,  141,  141,  141,  164,
  857.       179,  126,  139,  142,  142,  142,  179,  150,  141,  150,
  858.       170,  157,  166,  166,  166,  142,  214,  164,  170,  141,
  859.       157,  142,  150,  141,  167,  167,  167,  181,  181,  181,
  860.  
  861.       217,  214,  157,  196,  182,  182,  182,  181,  183,  196,
  862.       183,  183,  183,  220,  182,  181,  182,  184,  184,  184,
  863.       217,  150,  182,  186,  186,  186,  190,  190,  190,  184,
  864.       191,  191,  191,  220,  227,  184,  198,  198,  198,  199,
  865.       199,  199,  504,  201,  201,  201,  198,  207,  218,  199,
  866.       207,  199,  227,  222,  198,  201,  200,  199,  200,  200,
  867.       200,  201,  204,  224,  204,  205,  205,  205,  210,  210,
  868.       210,  204,  218,  211,  205,  211,  205,  215,  223,  215,
  869.       222,  225,  226,  205,  210,  228,  229,  231,  224,  211,
  870.       230,  226,  232,  226,  297,  223,  225,  501,  231,  230,
  871.  
  872.       232,  233,  233,  233,  229,  234,  234,  234,  249,  500,
  873.       228,  236,  236,  236,  297,  210,  249,  258,  258,  258,
  874.       211,  215,  219,  219,  219,  219,  219,  219,  219,  219,
  875.       219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
  876.       219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
  877.       219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
  878.       219,  219,  219,  219,  219,  219,  219,  268,  219,  219,
  879.       219,  219,  221,  221,  221,  242,  268,  242,  251,  251,
  880.       251,  253,  253,  253,  268,  499,  254,  221,  254,  259,
  881.       259,  259,  261,  261,  261,  272,  251,  253,  282,  279,
  882.  
  883.       221,  279,  254,  270,  270,  270,  272,  278,  278,  278,
  884.       272,  281,  283,  281,  295,  279,  221,  282,  288,  242,
  885.       293,  270,  291,  278,  284,  284,  284,  281,  253,  293,
  886.       294,  296,  298,  254,  299,  377,  284,  283,  295,  284,
  887.       300,  299,  284,  288,  291,  341,  279,  289,  289,  289,
  888.       301,  298,  342,  302,  278,  294,  296,  377,  281,  285,
  889.       285,  301,  342,  300,  302,  341,  285,  285,  285,  285,
  890.       285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
  891.       285,  285,  285,  285,  285,  285,  285,  285,  286,  286,
  892.       430,  289,  497,  430,  303,  286,  286,  286,  286,  286,
  893.  
  894.       286,  286,  286,  286,  286,  286,  286,  286,  286,  286,
  895.       286,  286,  286,  286,  286,  286,  286,  303,  304,  304,
  896.       496,  304,  304,  304,  304,  304,  304,  304,  304,  304,
  897.       304,  304,  304,  304,  304,  304,  304,  304,  304,  304,
  898.       304,  304,  304,  304,  304,  304,  304,  304,  304,  304,
  899.       304,  304,  304,  304,  304,  304,  304,  304,  304,  304,
  900.       304,  304,  304,  304,  304,  304,  304,  304,  305,  305,
  901.       305,  311,  495,  311,  318,  318,  318,  319,  321,  319,
  902.       321,  324,  324,  324,  335,  337,  335,  340,  346,  343,
  903.       318,  343,  344,  319,  321,  336,  336,  336,  345,  348,
  904.  
  905.       335,  347,  381,  364,  343,  364,  337,  384,  340,  382,
  906.       344,  349,  349,  349,  346,  311,  345,  386,  347,  364,
  907.       382,  318,  348,  336,  319,  321,  349,  381,  385,  349,
  908.       384,  335,  386,  343,  374,  374,  374,  387,  408,  336,
  909.       375,  375,  375,  374,  411,  374,  385,  397,  397,  397,
  910.       364,  411,  374,  403,  403,  403,  409,  349,  408,  412,
  911.       387,  405,  405,  405,  407,  397,  407,  407,  407,  410,
  912.       405,  403,  405,  413,  427,  416,  427,  409,  407,  405,
  913.       410,  412,  432,  427,  375,  494,  416,  413,  491,  407,
  914.       419,  419,  419,  407,  416,  420,  434,  420,  420,  420,
  915.  
  916.       419,  435,  489,  436,  425,  425,  425,  432,  419,  421,
  917.       421,  421,  421,  426,  425,  426,  426,  426,  434,  421,
  918.       435,  421,  425,  436,  437,  421,  442,  421,  428,  428,
  919.       428,  437,  443,  462,  442,  446,  450,  428,  466,  428,
  920.       443,  421,  451,  446,  450,  452,  428,  488,  466,  421,
  921.       451,  487,  486,  452,  462,  421,  421,  433,  433,  433,
  922.       433,  433,  433,  433,  433,  433,  433,  433,  433,  433,
  923.       433,  433,  433,  433,  433,  433,  433,  433,  433,  433,
  924.       433,  433,  433,  433,  433,  433,  433,  433,  433,  433,
  925.       433,  433,  433,  433,  433,  433,  433,  433,  433,  433,
  926.  
  927.       433,  433,  433,  433,  433,  433,  433,  448,  448,  448,
  928.       449,  454,  457,  456,  456,  456,  467,  465,  468,  485,
  929.       454,  484,  469,  457,  477,  448,  479,  457,  454,  481,
  930.       449,  456,  465,  469,  476,  467,  475,  479,  449,  468,
  931.       481,  469,  470,  470,  470,  478,  478,  478,  478,  478,
  932.       478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
  933.       478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
  934.       478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
  935.       478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
  936.       478,  478,  478,  478,  478,  480,  482,  483,  492,  493,
  937.  
  938.       498,  502,  506,  474,  482,  483,  473,  472,  471,  464,
  939.       493,  461,  460,  480,  459,  458,  455,  447,  444,  498,
  940.       441,  492,  439,  438,  431,  502,  429,  424,  423,  422,
  941.       418,  506,  515,  515,  515,  515,  515,  515,  515,  515,
  942.       515,  515,  515,  516,  516,  516,  516,  516,  516,  516,
  943.       516,  516,  516,  516,  517,  517,  517,  517,  517,  517,
  944.       517,  517,  517,  517,  517,  518,  518,  518,  518,  518,
  945.       518,  518,  518,  518,  518,  518,  519,  519,  519,  519,
  946.       519,  519,  519,  519,  519,  519,  519,  520,  520,  520,
  947.       520,  520,  520,  520,  520,  520,  520,  520,  521,  521,
  948.  
  949.       521,  521,  521,  521,  521,  521,  521,  521,  521,  522,
  950.       522,  522,  522,  522,  522,  522,  522,  522,  522,  522,
  951.       523,  523,  523,  523,  523,  523,  523,  523,  523,  523,
  952.       523,  524,  524,  524,  524,  524,  524,  524,  524,  524,
  953.       524,  524,  525,  525,  525,  417,  525,  415,  525,  414,
  954.       404,  525,  526,  526,  402,  526,  526,  526,  526,  526,
  955.       526,  526,  526,  527,  527,  401,  527,  527,  527,  527,
  956.       527,  527,  400,  527,  528,  528,  399,  528,  528,  528,
  957.       528,  528,  528,  392,  528,  529,  529,  391,  529,  529,
  958.       529,  529,  529,  529,  390,  529,  530,  530,  389,  530,
  959.  
  960.       531,  531,  388,  531,  532,  532,  380,  379,  373,  372,
  961.       532,  371,  370,  532,  533,  533,  533,  533,  533,  533,
  962.       533,  533,  533,  533,  533,  534,  534,  534,  534,  534,
  963.       534,  534,  534,  534,  534,  534,  535,  535,  369,  535,
  964.       536,  536,  368,  367,  366,  365,  536,  363,  362,  536,
  965.       537,  537,  361,  360,  359,  358,  537,  357,  356,  537,
  966.       538,  538,  538,  538,  538,  538,  538,  538,  538,  355,
  967.       538,  539,  539,  539,  539,  539,  539,  539,  539,  539,
  968.       539,  539,  540,  540,  540,  540,  540,  540,  540,  540,
  969.       540,  540,  540,  541,  541,  354,  353,  541,  542,  352,
  970.  
  971.       542,  543,  543,  543,  543,  543,  543,  543,  543,  351,
  972.       543,  543,  334,  333,  332,  331,  330,  329,  328,  327,
  973.       326,  325,  323,  317,  316,  315,  314,  313,  312,  310,
  974.       309,  308,  307,  306,  277,  276,  275,  274,  273,  271,
  975.       269,  266,  265,  264,  263,  262,  257,  256,  255,  252,
  976.       250,  247,  246,  245,  244,  243,  241,  240,  239,  238,
  977.       237,  213,  212,  209,  208,  206,  203,  202,  197,  195,
  978.       194,  193,  192,  189,  188,  187,  185,  180,  178,  177,
  979.       176,  175,  174,  173,  172,  171,  168,  148,  147,  146,
  980.       143,  134,  133,  132,  131,  129,  128,  127,  122,  121,
  981.  
  982.       120,  119,  117,  114,  112,  111,   91,   90,   84,   77,
  983.        71,   47,   39,   38,   30,   27,   24,   23,   16,   15,
  984.        14,   13,  514,  514,  514,  514,  514,  514,  514,  514,
  985.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  986.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  987.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  988.       514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
  989.       514,  514,  514
  990.     } ;
  991.  
  992. static yy_state_type yy_last_accepting_state;
  993. static YY_CHAR *yy_last_accepting_cpos;
  994.  
  995. static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
  996. static YY_CHAR *yy_full_match;
  997. static int yy_lp;
  998. static int yy_looking_for_trail_begin = 0;
  999. static int yy_full_lp;
  1000. static int *yy_full_state;
  1001. #define YY_TRAILING_MASK 0x2000
  1002. #define YY_TRAILING_HEAD_MASK 0x4000
  1003. #define REJECT \
  1004. { \
  1005. *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
  1006. yy_cp = yy_full_match; /* restore poss. backed-over text */ \
  1007. yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \
  1008. yy_state_ptr = yy_full_state; /* restore orig. state */ \
  1009. yy_current_state = *yy_state_ptr; /* restore curr. state */ \
  1010. ++yy_lp; \
  1011. goto find_rule; \
  1012. }
  1013. #define yymore() yymore_used_but_not_detected
  1014. #define YY_MORE_ADJ 0
  1015.  
  1016. /* these variables are all declared out here so that section 3 code can
  1017.  * manipulate them
  1018.  */
  1019. /* points to current character in buffer */
  1020. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  1021. static int yy_init = 1;        /* whether we need to initialize */
  1022. static int yy_start = 0;    /* start state number */
  1023.  
  1024. /* flag which is used to allow yywrap()'s to do buffer switches
  1025.  * instead of setting up a fresh yyin.  A bit of a hack ...
  1026.  */
  1027. static int yy_did_buffer_switch_on_eof;
  1028.  
  1029. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  1030. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  1031. static int yy_get_next_buffer YY_PROTO(( void ));
  1032. static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
  1033. void yyrestart YY_PROTO(( FILE *input_file ));
  1034. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  1035. void yy_load_buffer_state YY_PROTO(( void ));
  1036. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  1037. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  1038. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  1039.  
  1040. #define yy_new_buffer yy_create_buffer
  1041.  
  1042. #ifdef __cplusplus
  1043. static int yyinput YY_PROTO(( void ));
  1044. #else
  1045. static int input YY_PROTO(( void ));
  1046. #endif
  1047.  
  1048. YY_DECL
  1049.     {
  1050.     register yy_state_type yy_current_state;
  1051.     register YY_CHAR *yy_cp, *yy_bp;
  1052.     register int yy_act;
  1053.  
  1054.  
  1055.  
  1056.  
  1057.     if ( yy_init )
  1058.     {
  1059.     YY_USER_INIT;
  1060.  
  1061.     if ( ! yy_start )
  1062.         yy_start = 1;    /* first start state */
  1063.  
  1064.     if ( ! yyin )
  1065.         yyin = stdin;
  1066.  
  1067.     if ( ! yyout )
  1068.         yyout = stdout;
  1069.  
  1070.     if ( yy_current_buffer )
  1071.         yy_init_buffer( yy_current_buffer, yyin );
  1072.     else
  1073.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  1074.  
  1075.     yy_load_buffer_state();
  1076.  
  1077.     yy_init = 0;
  1078.     }
  1079.  
  1080.     while ( 1 )        /* loops until end-of-file is reached */
  1081.     {
  1082.     yy_cp = yy_c_buf_p;
  1083.  
  1084.     /* support of yytext */
  1085.     *yy_cp = yy_hold_char;
  1086.  
  1087.     /* yy_bp points to the position in yy_ch_buf of the start of the
  1088.      * current run.
  1089.      */
  1090.     yy_bp = yy_cp;
  1091.  
  1092.     yy_current_state = yy_start;
  1093.     yy_state_ptr = yy_state_buf;
  1094.     *yy_state_ptr++ = yy_current_state;
  1095. yy_match:
  1096.     do
  1097.         {
  1098.         register YY_CHAR yy_c = yy_ec[*yy_cp];
  1099.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1100.         {
  1101.         yy_current_state = yy_def[yy_current_state];
  1102.         if ( yy_current_state >= 515 )
  1103.             yy_c = yy_meta[yy_c];
  1104.         }
  1105.         yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1106.         *yy_state_ptr++ = yy_current_state;
  1107.         ++yy_cp;
  1108.         }
  1109.     while ( yy_current_state != 514 );
  1110.  
  1111. yy_find_action:
  1112.     yy_current_state = *--yy_state_ptr;
  1113.     yy_lp = yy_accept[yy_current_state];
  1114. find_rule: /* we branch to this label when backtracking */
  1115.     for ( ; ; ) /* until we find what rule we matched */
  1116.         {
  1117.         if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
  1118.         {
  1119.         yy_act = yy_acclist[yy_lp];
  1120.         if ( yy_act & YY_TRAILING_HEAD_MASK ||
  1121.              yy_looking_for_trail_begin )
  1122.             {
  1123.             if ( yy_act == yy_looking_for_trail_begin )
  1124.             {
  1125.             yy_looking_for_trail_begin = 0;
  1126.             yy_act &= ~YY_TRAILING_HEAD_MASK;
  1127.             break;
  1128.             }
  1129.             }
  1130.         else if ( yy_act & YY_TRAILING_MASK )
  1131.             {
  1132.             yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
  1133.             yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
  1134.             }
  1135.         else
  1136.             {
  1137.             yy_full_match = yy_cp;
  1138.             yy_full_state = yy_state_ptr;
  1139.             yy_full_lp = yy_lp;
  1140.             break;
  1141.             }
  1142.         ++yy_lp;
  1143.         goto find_rule;
  1144.         }
  1145.         --yy_cp;
  1146.         yy_current_state = *--yy_state_ptr;
  1147.         yy_lp = yy_accept[yy_current_state];
  1148.         }
  1149.  
  1150.     YY_DO_BEFORE_ACTION;
  1151.     YY_USER_ACTION;
  1152.  
  1153. do_action:    /* this label is used only to access EOF actions */
  1154.  
  1155.  
  1156.     switch ( yy_act )
  1157.         {
  1158. case 1:
  1159. # line 146 "lacheck.lex"
  1160. { ; }
  1161.     YY_BREAK
  1162. case 2:
  1163. # line 148 "lacheck.lex"
  1164. { ; }
  1165.     YY_BREAK
  1166. case 3:
  1167. # line 150 "lacheck.lex"
  1168. { ; }
  1169.     YY_BREAK
  1170. case 4:
  1171. # line 152 "lacheck.lex"
  1172. { line_count++; }
  1173.     YY_BREAK
  1174. case 5:
  1175. # line 154 "lacheck.lex"
  1176. { ; }
  1177.     YY_BREAK
  1178. case 6:
  1179. # line 156 "lacheck.lex"
  1180. { ; }
  1181.     YY_BREAK
  1182. case 7:
  1183. # line 158 "lacheck.lex"
  1184. { ; }
  1185.     YY_BREAK
  1186. case 8:
  1187. # line 160 "lacheck.lex"
  1188. {  push( "{", 0, line_count);}
  1189.     YY_BREAK
  1190. case 9:
  1191. # line 162 "lacheck.lex"
  1192. {  g_checkend(0); }
  1193.     YY_BREAK
  1194. case 10:
  1195. # line 164 "lacheck.lex"
  1196. BEGIN(DEF);
  1197.     YY_BREAK
  1198. case 11:
  1199. # line 167 "lacheck.lex"
  1200. { ++def_count; }
  1201.     YY_BREAK
  1202. case 12:
  1203. # line 169 "lacheck.lex"
  1204. { --def_count;
  1205.          if(def_count == 0)
  1206.              BEGIN(INITIAL); }
  1207.     YY_BREAK
  1208. case 13:
  1209. # line 173 "lacheck.lex"
  1210. { ; }
  1211.     YY_BREAK
  1212. case 14:
  1213. # line 175 "lacheck.lex"
  1214. BEGIN(ENV_DEF);
  1215.     YY_BREAK
  1216. case 15:
  1217. # line 177 "lacheck.lex"
  1218. { ++def_count; }
  1219.     YY_BREAK
  1220. case 16:
  1221. # line 179 "lacheck.lex"
  1222. { --def_count;
  1223.          if(def_count == 0)
  1224.              BEGIN(DEF); }
  1225.     YY_BREAK
  1226. case 17:
  1227. # line 183 "lacheck.lex"
  1228. { ; }
  1229.     YY_BREAK
  1230. case 18:
  1231. # line 185 "lacheck.lex"
  1232. {
  1233.     if(CG_TYPE == 4 || CG_TYPE == 5)
  1234.     print_bad_match(yytext,4);
  1235.     else
  1236.     {
  1237.     push( yytext, 4, line_count);
  1238.     }}
  1239.     YY_BREAK
  1240. case 19:
  1241. # line 193 "lacheck.lex"
  1242. {  g_checkend(4); }
  1243.     YY_BREAK
  1244. case 20:
  1245. # line 195 "lacheck.lex"
  1246. {
  1247.     if(CG_TYPE == 4 || CG_TYPE == 5)
  1248.     print_bad_match(yytext,5);
  1249.     else 
  1250.     {
  1251.     push( yytext, 5, line_count);
  1252.     }}
  1253.     YY_BREAK
  1254. case 21:
  1255. # line 204 "lacheck.lex"
  1256. {  g_checkend(5);     BEGIN(AFTER_DISPLAY);}
  1257.     YY_BREAK
  1258. case 22:
  1259. # line 206 "lacheck.lex"
  1260.  
  1261.     printf( "\"%s\", line %d: puctation mark \"%s\" should be placed before end of displaymath\n", 
  1262.        file_name, line_count, yytext); 
  1263.     ++warn_count ; 
  1264.  
  1265.   BEGIN(INITIAL); }
  1266.     YY_BREAK
  1267. case 23:
  1268. # line 214 "lacheck.lex"
  1269. {  BEGIN(INITIAL); }
  1270.     YY_BREAK
  1271. case 24:
  1272. # line 216 "lacheck.lex"
  1273. {     ++line_count; 
  1274.             BEGIN(INITIAL); }
  1275.     YY_BREAK
  1276. case 25:
  1277. *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
  1278. yy_c_buf_p = yy_cp = yy_bp + 1;
  1279. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1280. # line 219 "lacheck.lex"
  1281. { if (CG_TYPE == 4)
  1282.        {
  1283.      printf( "\"%s\", line %d: puctation mark \"%s\" should be placed after end of math mode\n", 
  1284.         file_name, line_count, yytext); 
  1285.      ++warn_count ;
  1286.        }}
  1287.     YY_BREAK
  1288. case 26:
  1289. # line 226 "lacheck.lex"
  1290. {
  1291.  
  1292.     if(CG_TYPE == 5)
  1293.     print_bad_match(yytext, 4);
  1294.     else 
  1295.  
  1296.     if(CG_TYPE == 4)
  1297.     {
  1298.     e_checkend(4, yytext);
  1299.     }
  1300.     else
  1301.     {
  1302.     push( yytext, 4, line_count); 
  1303.     }}
  1304.     YY_BREAK
  1305. case 27:
  1306. # line 242 "lacheck.lex"
  1307. {
  1308.  
  1309.     if(CG_TYPE == 4)
  1310.     print_bad_match(yytext,5);
  1311.     else 
  1312.  
  1313.     if(CG_TYPE == 5)
  1314.     {
  1315.     e_checkend(5, yytext);
  1316.         BEGIN(AFTER_DISPLAY);
  1317.     }
  1318.     else
  1319.     {
  1320.     push( yytext, 5, line_count);
  1321.     }}
  1322.     YY_BREAK
  1323. case 28:
  1324. *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
  1325. yy_c_buf_p = yy_cp = yy_bp + 11;
  1326. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1327. # line 258 "lacheck.lex"
  1328. {
  1329.  {
  1330.     push((unsigned char *)"\\begingroup", 1, line_count); 
  1331.  }}
  1332.     YY_BREAK
  1333. case 29:
  1334. *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
  1335. yy_c_buf_p = yy_cp = yy_bp + 9;
  1336. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1337. # line 264 "lacheck.lex"
  1338. {
  1339.  {
  1340.     g_checkend(1);
  1341.  }}
  1342.     YY_BREAK
  1343. case 30:
  1344. # line 270 "lacheck.lex"
  1345. { BEGIN(B_ENVIRONMENT); }
  1346.     YY_BREAK
  1347. case 31:
  1348. *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
  1349. yy_c_buf_p = yy_cp -= 1;
  1350. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1351. # line 272 "lacheck.lex"
  1352.  {
  1353.     
  1354.     printf("\"%s\", line %i: {argument} missing for \\begin\n",
  1355.        file_name, line_count) ;
  1356.     ++warn_count;
  1357.  }}
  1358.     YY_BREAK
  1359. case 32:
  1360. # line 280 "lacheck.lex"
  1361.  {
  1362.     if (strcmp( yytext, "verbatim" ) == 0 )
  1363.     {
  1364.      input();
  1365.      BEGIN(VERBATIM);
  1366.     }
  1367.     else
  1368.     {
  1369.          push(yytext, 2, line_count);
  1370.       input();
  1371.      BEGIN(INITIAL);
  1372.     }
  1373.  }}
  1374.     YY_BREAK
  1375. case 33:
  1376. # line 295 "lacheck.lex"
  1377. { BEGIN(INITIAL); }
  1378.     YY_BREAK
  1379. case 34:
  1380. # line 297 "lacheck.lex"
  1381. {
  1382.      printf("\"%s\", line %i: TAB character in verbatim environment\n",
  1383.        file_name, line_count) ;
  1384.     ++warn_count;
  1385.  }
  1386.     YY_BREAK
  1387. case 35:
  1388. # line 303 "lacheck.lex"
  1389. { ; }
  1390.     YY_BREAK
  1391. case 36:
  1392. # line 305 "lacheck.lex"
  1393. { ++line_count; }
  1394.     YY_BREAK
  1395. case 37:
  1396. # line 308 "lacheck.lex"
  1397.       sscanf (yytext, "\\verb%c", &verb_char  ); 
  1398.       BEGIN(VERB); 
  1399.     }
  1400.     YY_BREAK
  1401. case 38:
  1402. # line 313 "lacheck.lex"
  1403. {
  1404.         if ( *yytext == (unsigned char)verb_char )
  1405.           BEGIN(INITIAL); 
  1406.         if ( *yytext == '\n' )
  1407.            ++line_count;
  1408.     } 
  1409.     YY_BREAK
  1410. case 39:
  1411. # line 321 "lacheck.lex"
  1412. { BEGIN(E_ENVIRONMENT); }
  1413.     YY_BREAK
  1414. case 40:
  1415. *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
  1416. yy_c_buf_p = yy_cp -= 1;
  1417. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1418. # line 323 "lacheck.lex"
  1419.  {
  1420.     printf("\"%s\", line %i: {argument} missing for \\end\n",
  1421.        file_name, line_count) ;
  1422.     ++warn_count;
  1423.  }}
  1424.     YY_BREAK
  1425. case 41:
  1426. # line 331 "lacheck.lex"
  1427.  {
  1428.     e_checkend(2, yytext);
  1429.     input();
  1430.     
  1431.     BEGIN(INITIAL);
  1432.  }}
  1433.     YY_BREAK
  1434. case 42:
  1435. # line 340 "lacheck.lex"
  1436.  {
  1437.     if ( *yytext == '\n' )
  1438.         ++line_count; 
  1439.  
  1440.     printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", 
  1441.        file_name, line_count, ++yytext); 
  1442.     ++warn_count ; 
  1443.  }}
  1444.     YY_BREAK
  1445. case 43:
  1446. # line 350 "lacheck.lex"
  1447.  {
  1448.     printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", 
  1449.        file_name, line_count, yytext); 
  1450.     ++warn_count ; 
  1451.  }}
  1452.     YY_BREAK
  1453. case 44:
  1454. # line 357 "lacheck.lex"
  1455.  {
  1456.     if ( *yytext == '\n' )
  1457.     ++line_count;
  1458.     printf("\"%s\", line %d: missing `\\@' before punctation mark in \"%s\"\n", 
  1459.        file_name, line_count, ++yytext); 
  1460.     ++warn_count ; 
  1461.  }}
  1462.     YY_BREAK
  1463. case 45:
  1464. # line 366 "lacheck.lex"
  1465.  {
  1466.     printf("\"%s\", line %d: missing `\\@' before `.' in \"%s\"\n", 
  1467.        file_name, line_count, yytext); 
  1468.     ++warn_count ; 
  1469.  }}
  1470.     YY_BREAK
  1471. case 46:
  1472. # line 373 "lacheck.lex"
  1473.  
  1474.     printf("\"%s\", line %d: double space at \"%s\"\n",
  1475.        file_name, line_count, yytext); 
  1476.     ++warn_count;
  1477.   }
  1478.     YY_BREAK
  1479. case 47:
  1480. # line 380 "lacheck.lex"
  1481. {
  1482.     printf("\"%s\", line %d: \\ldots should be \\cdots in \"%s\"\n",
  1483.        file_name, line_count, yytext); 
  1484.     ++warn_count;
  1485.   }
  1486.     YY_BREAK
  1487. case 48:
  1488. # line 386 "lacheck.lex"
  1489. {
  1490.     printf("\"%s\", line %d: \\cdots should be \\ldots in \"%s\"\n",
  1491.        file_name, line_count, yytext); 
  1492.     ++warn_count;
  1493.   }
  1494.     YY_BREAK
  1495. case 49:
  1496. # line 392 "lacheck.lex"
  1497. {
  1498.     printf("\"%s\", line %d: Dots should be \\cdots in \"%s\"\n",
  1499.        file_name, line_count, yytext); 
  1500.     ++warn_count;
  1501.   }
  1502.     YY_BREAK
  1503. case 50:
  1504. # line 398 "lacheck.lex"
  1505. {
  1506.     printf("\"%s\", line %d: Dots should be \\ldots in \"%s\"\n",
  1507.        file_name, line_count, yytext); 
  1508.     ++warn_count;
  1509.   }
  1510.     YY_BREAK
  1511. case 51:
  1512. # line 405 "lacheck.lex"
  1513.     printf("\"%s\", line %d: Dots should be ellipsis \"%s\"\n",
  1514.        file_name, line_count, yytext); 
  1515.     ++warn_count;
  1516.   }
  1517.     YY_BREAK
  1518. case 52:
  1519. # line 411 "lacheck.lex"
  1520. {
  1521.  
  1522.     printf("\"%s\", line %d: perhaps you should insert a `~' before \"%s\"\n",
  1523.        file_name, line_count, ++yytext); 
  1524.   }
  1525.     YY_BREAK
  1526.  /*
  1527.  {primitive}/[^a-zA-Z] {
  1528.  {
  1529.     printf("\"%s\", line %d: Don't use \"%s\" in LaTeX documents\n", 
  1530.        file_name, line_count, yytext); 
  1531.     ++warn_count ; 
  1532.  }}    
  1533.  */
  1534. case 53:
  1535. # line 427 "lacheck.lex"
  1536.  {
  1537.     printf("\"%s\", line %d: Fontspecifiers don't take arguments. \"%s\"\n", 
  1538.        file_name, line_count, yytext); 
  1539.     ++warn_count; 
  1540.   /*    (void) input(); */
  1541.  }}
  1542.     YY_BREAK
  1543. case 54:
  1544. # line 436 "lacheck.lex"
  1545.  {
  1546.     printf("\"%s\", line %d: Do not use @ in LaTeX macro names. \"%s\"\n", 
  1547.        file_name, line_count, yytext); 
  1548.     ++warn_count; 
  1549.  }}
  1550.     YY_BREAK
  1551. case 55:
  1552. # line 443 "lacheck.lex"
  1553.  {
  1554.     printf("\"%s\", line %d: Use ` to begin quotation, not ' \"%s\"\n", 
  1555.        file_name, line_count, yytext); 
  1556.     ++warn_count; 
  1557.  }}
  1558.     YY_BREAK
  1559. case 56:
  1560. # line 450 "lacheck.lex"
  1561.  {
  1562.     printf("\"%s\", line %d: Use ' to end quotation, not ` \"%s\"\n", 
  1563.        file_name, line_count, yytext); 
  1564.     ++warn_count; 
  1565.  }}
  1566.     YY_BREAK
  1567. case 57:
  1568. # line 458 "lacheck.lex"
  1569.  {
  1570.     printf("\"%s\", line %d: Whitespace before punctation mark in \"%s\"\n", 
  1571.        file_name, line_count, yytext); 
  1572.     ++warn_count; 
  1573.  }}
  1574.     YY_BREAK
  1575. case 58:
  1576. # line 466 "lacheck.lex"
  1577. { BEGIN(COMMENT); }
  1578.     YY_BREAK
  1579. case 59:
  1580. # line 468 "lacheck.lex"
  1581. { BEGIN(INITIAL); ++line_count; }
  1582.     YY_BREAK
  1583. case 60:
  1584. # line 470 "lacheck.lex"
  1585. { ; }
  1586.     YY_BREAK
  1587. case 61:
  1588. # line 473 "lacheck.lex"
  1589. { BEGIN(INCLUDE); }
  1590.     YY_BREAK
  1591. case 62:
  1592. # line 475 "lacheck.lex"
  1593. {
  1594.  {
  1595.     if ( strstr(yytext,".sty") == NULL )
  1596.     {
  1597.         input_file(yytext);
  1598.     }
  1599.     else
  1600.     {
  1601.         printf("\"%s\", line %d: Style file `%s\' omitted.\n",
  1602.             file_name,
  1603.             line_count,
  1604.             yytext);
  1605.         input();
  1606.     }
  1607.     BEGIN(INITIAL);
  1608.  }}
  1609.     YY_BREAK
  1610. case YY_STATE_EOF(INITIAL):
  1611. case YY_STATE_EOF(B_ENVIRONMENT):
  1612. case YY_STATE_EOF(E_ENVIRONMENT):
  1613. case YY_STATE_EOF(VERBATIM):
  1614. case YY_STATE_EOF(INCLUDE):
  1615. case YY_STATE_EOF(MATH):
  1616. case YY_STATE_EOF(COMMENT):
  1617. case YY_STATE_EOF(VERB):
  1618. case YY_STATE_EOF(DEF):
  1619. case YY_STATE_EOF(AFTER_DISPLAY):
  1620. case YY_STATE_EOF(ENV_DEF):
  1621. # line 492 "lacheck.lex"
  1622.       if (--istackp < 0)
  1623.           yyterminate(); 
  1624.  
  1625.       else
  1626.         { 
  1627.           fclose(yyin);
  1628.             f_checkend(file_name);
  1629.           yy_switch_to_buffer(istack[istackp].stream);
  1630.           free(file_name);
  1631.           line_count = istack[istackp].linenum;
  1632.           file_name = istack[istackp].name;
  1633.           input();
  1634.           BEGIN(INITIAL);
  1635.         }        
  1636.      
  1637.     }
  1638.     YY_BREAK
  1639. case 64:
  1640. # line 511 "lacheck.lex"
  1641. { ; }
  1642.     YY_BREAK
  1643. case 65:
  1644. # line 512 "lacheck.lex"
  1645. ECHO;
  1646.     YY_BREAK
  1647.  
  1648.         case YY_END_OF_BUFFER:
  1649.         {
  1650.         /* amount of text matched not including the EOB char */
  1651.         int yy_amount_of_matched_text = yy_cp - yytext - 1;
  1652.  
  1653.         /* undo the effects of YY_DO_BEFORE_ACTION */
  1654.         *yy_cp = yy_hold_char;
  1655.  
  1656.         /* note that here we test for yy_c_buf_p "<=" to the position
  1657.          * of the first EOB in the buffer, since yy_c_buf_p will
  1658.          * already have been incremented past the NUL character
  1659.          * (since all states make transitions on EOB to the end-
  1660.          * of-buffer state).  Contrast this with the test in yyinput().
  1661.          */
  1662.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1663.             /* this was really a NUL */
  1664.             {
  1665.             yy_state_type yy_next_state;
  1666.  
  1667.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  1668.  
  1669.             yy_current_state = yy_get_previous_state();
  1670.  
  1671.             /* okay, we're now positioned to make the
  1672.              * NUL transition.  We couldn't have
  1673.              * yy_get_previous_state() go ahead and do it
  1674.              * for us because it doesn't know how to deal
  1675.              * with the possibility of jamming (and we
  1676.              * don't want to build jamming into it because
  1677.              * then it will run more slowly)
  1678.              */
  1679.  
  1680.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  1681.  
  1682.             yy_bp = yytext + YY_MORE_ADJ;
  1683.  
  1684.             if ( yy_next_state )
  1685.             {
  1686.             /* consume the NUL */
  1687.             yy_cp = ++yy_c_buf_p;
  1688.             yy_current_state = yy_next_state;
  1689.             goto yy_match;
  1690.             }
  1691.  
  1692.             else
  1693.             {
  1694.             goto yy_find_action;
  1695.             }
  1696.             }
  1697.  
  1698.         else switch ( yy_get_next_buffer() )
  1699.             {
  1700.             case EOB_ACT_END_OF_FILE:
  1701.             {
  1702.             yy_did_buffer_switch_on_eof = 0;
  1703.  
  1704.             if ( yywrap() )
  1705.                 {
  1706.                 /* note: because we've taken care in
  1707.                  * yy_get_next_buffer() to have set up yytext,
  1708.                  * we can now set up yy_c_buf_p so that if some
  1709.                  * total hoser (like flex itself) wants
  1710.                  * to call the scanner after we return the
  1711.                  * YY_NULL, it'll still work - another YY_NULL
  1712.                  * will get returned.
  1713.                  */
  1714.                 yy_c_buf_p = yytext + YY_MORE_ADJ;
  1715.  
  1716.                 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  1717.                 goto do_action;
  1718.                 }
  1719.  
  1720.             else
  1721.                 {
  1722.                 if ( ! yy_did_buffer_switch_on_eof )
  1723.                 YY_NEW_FILE;
  1724.                 }
  1725.             }
  1726.             break;
  1727.  
  1728.             case EOB_ACT_CONTINUE_SCAN:
  1729.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  1730.  
  1731.             yy_current_state = yy_get_previous_state();
  1732.  
  1733.             yy_cp = yy_c_buf_p;
  1734.             yy_bp = yytext + YY_MORE_ADJ;
  1735.             goto yy_match;
  1736.  
  1737.             case EOB_ACT_LAST_MATCH:
  1738.             yy_c_buf_p =
  1739.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  1740.  
  1741.             yy_current_state = yy_get_previous_state();
  1742.  
  1743.             yy_cp = yy_c_buf_p;
  1744.             yy_bp = yytext + YY_MORE_ADJ;
  1745.             goto yy_find_action;
  1746.             }
  1747.         break;
  1748.         }
  1749.  
  1750.         default:
  1751. #ifdef FLEX_DEBUG
  1752.         printf( "action # %d\n", yy_act );
  1753. #endif
  1754.         YY_FATAL_ERROR(
  1755.             "fatal flex scanner internal error--no action found" );
  1756.         }
  1757.     }
  1758.     }
  1759.  
  1760.  
  1761. /* yy_get_next_buffer - try to read in a new buffer
  1762.  *
  1763.  * synopsis
  1764.  *     int yy_get_next_buffer();
  1765.  *     
  1766.  * returns a code representing an action
  1767.  *     EOB_ACT_LAST_MATCH - 
  1768.  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1769.  *     EOB_ACT_END_OF_FILE - end of file
  1770.  */
  1771.  
  1772. static int yy_get_next_buffer()
  1773.  
  1774.     {
  1775.     register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  1776.     register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  1777.     register int number_to_move, i;
  1778.     int ret_val;
  1779.  
  1780.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  1781.     YY_FATAL_ERROR(
  1782.         "fatal flex scanner internal error--end of buffer missed" );
  1783.  
  1784.     /* try to read more data */
  1785.  
  1786.     /* first move last chars to start of buffer */
  1787.     number_to_move = yy_c_buf_p - yytext;
  1788.  
  1789.     for ( i = 0; i < number_to_move; ++i )
  1790.     *(dest++) = *(source++);
  1791.  
  1792.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  1793.     /* don't do the read, it's not guaranteed to return an EOF,
  1794.      * just force an EOF
  1795.      */
  1796.     yy_n_chars = 0;
  1797.  
  1798.     else
  1799.     {
  1800.     int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  1801.  
  1802.     if ( num_to_read > YY_READ_BUF_SIZE )
  1803.         num_to_read = YY_READ_BUF_SIZE;
  1804.  
  1805.     else if ( num_to_read <= 0 )
  1806.         YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  1807.  
  1808.     /* read in more data */
  1809.     YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  1810.           yy_n_chars, num_to_read );
  1811.     }
  1812.  
  1813.     if ( yy_n_chars == 0 )
  1814.     {
  1815.     if ( number_to_move == 1 )
  1816.         {
  1817.         ret_val = EOB_ACT_END_OF_FILE;
  1818.         yy_current_buffer->yy_eof_status = EOF_DONE;
  1819.         }
  1820.  
  1821.     else
  1822.         {
  1823.         ret_val = EOB_ACT_LAST_MATCH;
  1824.         yy_current_buffer->yy_eof_status = EOF_PENDING;
  1825.         }
  1826.     }
  1827.  
  1828.     else
  1829.     ret_val = EOB_ACT_CONTINUE_SCAN;
  1830.  
  1831.     yy_n_chars += number_to_move;
  1832.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1833.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1834.  
  1835.     /* yytext begins at the second character in yy_ch_buf; the first
  1836.      * character is the one which preceded it before reading in the latest
  1837.      * buffer; it needs to be kept around in case it's a newline, so
  1838.      * yy_get_previous_state() will have with '^' rules active
  1839.      */
  1840.  
  1841.     yytext = &yy_current_buffer->yy_ch_buf[1];
  1842.  
  1843.     return ( ret_val );
  1844.     }
  1845.  
  1846.  
  1847. /* yy_get_previous_state - get the state just before the EOB char was reached
  1848.  *
  1849.  * synopsis
  1850.  *     yy_state_type yy_get_previous_state();
  1851.  */
  1852.  
  1853. static yy_state_type yy_get_previous_state()
  1854.  
  1855.     {
  1856.     register yy_state_type yy_current_state;
  1857.     register YY_CHAR *yy_cp;
  1858.  
  1859.     yy_current_state = yy_start;
  1860.     yy_state_ptr = yy_state_buf;
  1861.     *yy_state_ptr++ = yy_current_state;
  1862.  
  1863.     for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  1864.     {
  1865.     register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
  1866.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1867.         {
  1868.         yy_current_state = yy_def[yy_current_state];
  1869.         if ( yy_current_state >= 515 )
  1870.         yy_c = yy_meta[yy_c];
  1871.         }
  1872.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1873.     *yy_state_ptr++ = yy_current_state;
  1874.     }
  1875.  
  1876.     return ( yy_current_state );
  1877.     }
  1878.  
  1879.  
  1880. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1881.  *
  1882.  * synopsis
  1883.  *     next_state = yy_try_NUL_trans( current_state );
  1884.  */
  1885.  
  1886. #ifdef YY_USE_PROTOS
  1887. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  1888. #else
  1889. static yy_state_type yy_try_NUL_trans( yy_current_state )
  1890. register yy_state_type yy_current_state;
  1891. #endif
  1892.  
  1893.     {
  1894.     register int yy_is_jam;
  1895.  
  1896.     register YY_CHAR yy_c = 1;
  1897.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1898.     {
  1899.     yy_current_state = yy_def[yy_current_state];
  1900.     if ( yy_current_state >= 515 )
  1901.         yy_c = yy_meta[yy_c];
  1902.     }
  1903.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1904.     *yy_state_ptr++ = yy_current_state;
  1905.     yy_is_jam = (yy_current_state == 514);
  1906.  
  1907.     return ( yy_is_jam ? 0 : yy_current_state );
  1908.     }
  1909.  
  1910.  
  1911. #ifdef YY_USE_PROTOS
  1912. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  1913. #else
  1914. static void yyunput( c, yy_bp )
  1915. YY_CHAR c;
  1916. register YY_CHAR *yy_bp;
  1917. #endif
  1918.  
  1919.     {
  1920.     register YY_CHAR *yy_cp = yy_c_buf_p;
  1921.  
  1922.     /* undo effects of setting up yytext */
  1923.     *yy_cp = yy_hold_char;
  1924.  
  1925.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1926.     { /* need to shift things up to make room */
  1927.     register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  1928.     register YY_CHAR *dest =
  1929.         &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  1930.     register YY_CHAR *source =
  1931.         &yy_current_buffer->yy_ch_buf[number_to_move];
  1932.  
  1933.     while ( source > yy_current_buffer->yy_ch_buf )
  1934.         *--dest = *--source;
  1935.  
  1936.     yy_cp += dest - source;
  1937.     yy_bp += dest - source;
  1938.     yy_n_chars = yy_current_buffer->yy_buf_size;
  1939.  
  1940.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1941.         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1942.     }
  1943.  
  1944.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  1945.     yy_cp[-2] = '\n';
  1946.  
  1947.     *--yy_cp = c;
  1948.  
  1949.     /* note: the formal parameter *must* be called "yy_bp" for this
  1950.      *       macro to now work correctly
  1951.      */
  1952.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  1953.     }
  1954.  
  1955.  
  1956. #ifdef __cplusplus
  1957. static int yyinput()
  1958. #else
  1959. static int input()
  1960. #endif
  1961.  
  1962.     {
  1963.     int c;
  1964.     YY_CHAR *yy_cp = yy_c_buf_p;
  1965.  
  1966.     *yy_cp = yy_hold_char;
  1967.  
  1968.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1969.     {
  1970.     /* yy_c_buf_p now points to the character we want to return.
  1971.      * If this occurs *before* the EOB characters, then it's a
  1972.      * valid NUL; if not, then we've hit the end of the buffer.
  1973.      */
  1974.     if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1975.         /* this was really a NUL */
  1976.         *yy_c_buf_p = '\0';
  1977.  
  1978.     else
  1979.         { /* need more input */
  1980.         yytext = yy_c_buf_p;
  1981.         ++yy_c_buf_p;
  1982.  
  1983.         switch ( yy_get_next_buffer() )
  1984.         {
  1985.         case EOB_ACT_END_OF_FILE:
  1986.             {
  1987.             if ( yywrap() )
  1988.             {
  1989.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  1990.             return ( EOF );
  1991.             }
  1992.  
  1993.             YY_NEW_FILE;
  1994.  
  1995. #ifdef __cplusplus
  1996.             return ( yyinput() );
  1997. #else
  1998.             return ( input() );
  1999. #endif
  2000.             }
  2001.             break;
  2002.  
  2003.         case EOB_ACT_CONTINUE_SCAN:
  2004.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  2005.             break;
  2006.  
  2007.         case EOB_ACT_LAST_MATCH:
  2008. #ifdef __cplusplus
  2009.             YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  2010. #else
  2011.             YY_FATAL_ERROR( "unexpected last match in input()" );
  2012. #endif
  2013.         }
  2014.         }
  2015.     }
  2016.  
  2017.     c = *yy_c_buf_p;
  2018.     yy_hold_char = *++yy_c_buf_p;
  2019.  
  2020.     return ( c );
  2021.     }
  2022.  
  2023.  
  2024. #ifdef YY_USE_PROTOS
  2025. void yyrestart( FILE *input_file )
  2026. #else
  2027. void yyrestart( input_file )
  2028. FILE *input_file;
  2029. #endif
  2030.  
  2031.     {
  2032.     yy_init_buffer( yy_current_buffer, input_file );
  2033.     yy_load_buffer_state();
  2034.     }
  2035.  
  2036.  
  2037. #ifdef YY_USE_PROTOS
  2038. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  2039. #else
  2040. void yy_switch_to_buffer( new_buffer )
  2041. YY_BUFFER_STATE new_buffer;
  2042. #endif
  2043.  
  2044.     {
  2045.     if ( yy_current_buffer == new_buffer )
  2046.     return;
  2047.  
  2048.     if ( yy_current_buffer )
  2049.     {
  2050.     /* flush out information for old buffer */
  2051.     *yy_c_buf_p = yy_hold_char;
  2052.     yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  2053.     yy_current_buffer->yy_n_chars = yy_n_chars;
  2054.     }
  2055.  
  2056.     yy_current_buffer = new_buffer;
  2057.     yy_load_buffer_state();
  2058.  
  2059.     /* we don't actually know whether we did this switch during
  2060.      * EOF (yywrap()) processing, but the only time this flag
  2061.      * is looked at is after yywrap() is called, so it's safe
  2062.      * to go ahead and always set it.
  2063.      */
  2064.     yy_did_buffer_switch_on_eof = 1;
  2065.     }
  2066.  
  2067.  
  2068. #ifdef YY_USE_PROTOS
  2069. void yy_load_buffer_state( void )
  2070. #else
  2071. void yy_load_buffer_state()
  2072. #endif
  2073.  
  2074.     {
  2075.     yy_n_chars = yy_current_buffer->yy_n_chars;
  2076.     yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  2077.     yyin = yy_current_buffer->yy_input_file;
  2078.     yy_hold_char = *yy_c_buf_p;
  2079.     }
  2080.  
  2081.  
  2082. #ifdef YY_USE_PROTOS
  2083. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  2084. #else
  2085. YY_BUFFER_STATE yy_create_buffer( file, size )
  2086. FILE *file;
  2087. int size;
  2088. #endif
  2089.  
  2090.     {
  2091.     YY_BUFFER_STATE b;
  2092.  
  2093.     b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  2094.  
  2095.     if ( ! b )
  2096.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  2097.  
  2098.     b->yy_buf_size = size;
  2099.  
  2100.     /* yy_ch_buf has to be 2 characters longer than the size given because
  2101.      * we need to put in 2 end-of-buffer characters.
  2102.      */
  2103.     b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  2104.  
  2105.     if ( ! b->yy_ch_buf )
  2106.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  2107.  
  2108.     yy_init_buffer( b, file );
  2109.  
  2110.     return ( b );
  2111.     }
  2112.  
  2113.  
  2114. #ifdef YY_USE_PROTOS
  2115. void yy_delete_buffer( YY_BUFFER_STATE b )
  2116. #else
  2117. void yy_delete_buffer( b )
  2118. YY_BUFFER_STATE b;
  2119. #endif
  2120.  
  2121.     {
  2122.     if ( b == yy_current_buffer )
  2123.     yy_current_buffer = (YY_BUFFER_STATE) 0;
  2124.  
  2125.     free( (char *) b->yy_ch_buf );
  2126.     free( (char *) b );
  2127.     }
  2128.  
  2129.  
  2130. #ifdef YY_USE_PROTOS
  2131. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  2132. #else
  2133. void yy_init_buffer( b, file )
  2134. YY_BUFFER_STATE b;
  2135. FILE *file;
  2136. #endif
  2137.  
  2138.     {
  2139.     b->yy_input_file = file;
  2140.  
  2141.     /* we put in the '\n' and start reading from [1] so that an
  2142.      * initial match-at-newline will be true.
  2143.      */
  2144.  
  2145.     b->yy_ch_buf[0] = '\n';
  2146.     b->yy_n_chars = 1;
  2147.  
  2148.     /* we always need two end-of-buffer characters.  The first causes
  2149.      * a transition to the end-of-buffer state.  The second causes
  2150.      * a jam in that state.
  2151.      */
  2152.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  2153.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  2154.  
  2155.     b->yy_buf_pos = &b->yy_ch_buf[1];
  2156.  
  2157.     b->yy_eof_status = EOF_NOT_SEEN;
  2158.     }
  2159. # line 512 "lacheck.lex"
  2160.  
  2161. int main( argc, argv )
  2162. int argc;
  2163. char *argv[];
  2164. {
  2165.     /* allocate initial stacks */
  2166.     gstack = (tex_group *)malloc(gstack_size * sizeof(tex_group));
  2167.     istack = (input_ *)malloc(istack_size * sizeof(input_));
  2168.     if ( gstack == NULL || istack == NULL ) {
  2169.     fprintf(stderr, "%s: not enough memory for stacks\n", PROGNAME);
  2170.     exit(3);
  2171.     }
  2172.     
  2173.     if(argc > 1)
  2174.     {
  2175.         if ( (file_name = malloc(strlen(argv[1]) + 5)) == NULL ) {
  2176.         fprintf(stderr, "%s: out of memory\n", PROGNAME);
  2177.         exit(3);
  2178.     }
  2179.     
  2180.     strcpy(file_name, argv[1]);
  2181.     
  2182.     if ((yyin = fopen( file_name, "r")) != NULL )
  2183.     {
  2184.         push(file_name, 3, 1);
  2185.         yylex();
  2186.         f_checkend(file_name);
  2187.     }
  2188.     else {   
  2189.          strcat(file_name, ".tex" );
  2190.          if ((yyin = fopen( file_name, "r")) != NULL )
  2191.          {
  2192.              push(file_name, 3, 1);
  2193.              yylex();
  2194.              f_checkend(file_name);
  2195.          }
  2196.          else
  2197.              fprintf(stderr,
  2198.                 "%s: Could not open : %s\n",PROGNAME, argv[1]);
  2199.          }
  2200.     }
  2201.     else
  2202.     {
  2203.     printf("\n* %s *\n\n",PROGNAME);
  2204.     printf("\t...a consistency checker for LaTeX documents.\n\n");
  2205.  
  2206.     printf("Usage:\n\tlacheck filename[.tex] <return>\n\n\n");
  2207.  
  2208.     printf("\tFrom within Emacs:\n\n\t");
  2209.     printf("M-x compile <return>\n\tlacheck filename[.tex] <return>");
  2210.     printf("\n\n\tUse C-x ` to step through the messages.\n\n");
  2211.     printf("\n\tThe found context is displayed in \"double quotes\"\n\n");
  2212.     printf("Remark:\n\tAll messages are only warnings!\n\n");
  2213.     printf("\tYour document may be right though LaCheck tells\n");
  2214.     printf("\tsomething else.\n\n");
  2215.     }
  2216.     return(0);
  2217. }
  2218.  
  2219. #ifdef NEED_STRSTR
  2220. char *
  2221. strstr(string, substring)
  2222.     register char *string;    /* String to search. */
  2223.     char *substring;        /* Substring to try to find in string. */
  2224. {
  2225.     register char *a, *b;
  2226.  
  2227.     /* First scan quickly through the two strings looking for a
  2228.      * single-character match.  When it's found, then compare the
  2229.      * rest of the substring.
  2230.      */
  2231.  
  2232.     b = substring;
  2233.     if (*b == 0) {
  2234.     return string;
  2235.     }
  2236.     for ( ; *string != 0; string += 1) {
  2237.     if (*string != *b) {
  2238.         continue;
  2239.     }
  2240.     a = string;
  2241.     while (1) {
  2242.         if (*b == 0) {
  2243.         return string;
  2244.         }
  2245.         if (*a++ != *b++) {
  2246.         break;
  2247.         }
  2248.     }
  2249.     b = substring;
  2250.     }
  2251.     return (char *) 0;
  2252. }
  2253. #endif /* NEED_STRSTR */
  2254.  
  2255. void push(p_name, p_type, p_line)
  2256. unsigned char *p_name;
  2257. int p_type;
  2258. int p_line;
  2259. {
  2260.     if ( gstackp == gstack_size ) {    /* extend stack */
  2261.     gstack_size *= 2;
  2262.     gstack = (tex_group *)realloc(gstack, gstack_size * sizeof(tex_group));
  2263.     if ( gstack == NULL ) {
  2264.         fprintf(stderr, "%s: stack out of memory", PROGNAME);
  2265.     exit(3);
  2266.     }
  2267.     }
  2268.     
  2269.     if ( (gstack[gstackp].s_name =
  2270.         (unsigned char *)malloc(strlen(p_name) + 1)) == NULL ||
  2271.          (gstack[gstackp].s_file =
  2272.         (char *)malloc(strlen(file_name) + 1)) == NULL ) {
  2273.     fprintf(stderr, "%s: out of memory\n", PROGNAME);
  2274.     exit(3);
  2275.     }
  2276.  
  2277.     strcpy(gstack[gstackp].s_name,p_name);
  2278.     gstack[gstackp].s_type = p_type;
  2279.     gstack[gstackp].s_line = p_line;    
  2280.     strcpy(gstack[gstackp].s_file,file_name);
  2281.     ++gstackp;    
  2282.  
  2283. }
  2284.  
  2285. void input_file(file_nam)
  2286. char *file_nam;
  2287. {
  2288.     char *tmp_file_name;
  2289.     FILE *tmp_yyin;
  2290.  
  2291.     if ( (tmp_file_name = malloc(strlen(file_nam) + 5)) == NULL ) {
  2292.     fprintf(stderr, "%s: out of memory\n", PROGNAME);
  2293.     exit(3);
  2294.     }
  2295.     strcpy(tmp_file_name,file_nam);
  2296.  
  2297.     if (istackp == istack_size) {    /* extend stack */
  2298.     istack_size *= 2;
  2299.     istack = (input_ *)realloc(istack, istack_size * sizeof(input_));
  2300.     if ( istack == NULL ) {
  2301.         fprintf(stderr, "%s: \\input stack out of memory\n", PROGNAME);
  2302.     exit(3);
  2303.         } 
  2304.     } 
  2305.         
  2306.     istack[istackp].stream = YY_CURRENT_BUFFER;
  2307.     istack[istackp].linenum = line_count;
  2308.     istack[istackp].name = file_name;
  2309.     ++istackp;    
  2310.  
  2311.     if ((tmp_yyin = fopen( file_nam, "r")) != NULL )
  2312.     {
  2313.       yyin = tmp_yyin;
  2314.       yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
  2315.       file_name = tmp_file_name;
  2316.       push(file_name, 3, 1);
  2317.           line_count = 1;
  2318.     }
  2319.     else {
  2320.       (void) strcat(tmp_file_name, ".tex");
  2321.       if ((tmp_yyin = fopen( tmp_file_name , "r")) != NULL )
  2322.         {
  2323.         yyin = tmp_yyin;
  2324.            yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
  2325.         file_name = tmp_file_name;
  2326.         push(file_name, 3, 1);
  2327.                line_count = 1;
  2328.         }
  2329.           else
  2330.       {
  2331.            --istackp;
  2332.            fclose(tmp_yyin);
  2333.            free(tmp_file_name);
  2334.            printf("\"%s\", line %d: Could not open \"%s\"\n", 
  2335.             file_name,
  2336.             line_count,
  2337.             file_nam);
  2338.            input();
  2339.       }
  2340.      }
  2341. }
  2342.  
  2343. void pop()
  2344. {
  2345.     if ( gstackp == 0 )
  2346.     {
  2347.            fprintf(stderr, "%s: Stack underflow\n", PROGNAME);
  2348.     exit(4);
  2349.     }
  2350.     --gstackp;
  2351.  
  2352.     free(gstack[gstackp].s_name);
  2353.     free(gstack[gstackp].s_file);
  2354. }
  2355.  
  2356. char *bg_command(name)
  2357. char *name;
  2358. {
  2359.     
  2360.     switch (CG_TYPE) {
  2361.     
  2362.     case 2:
  2363.     (void) strcpy( returnval, "\\begin\{" );
  2364.     (void) strcat( returnval, (char *) name);
  2365.     (void) strcat( returnval, "}" );
  2366.     break;
  2367.     
  2368.     case 3:
  2369.     (void) strcpy( returnval, "beginning of file " );
  2370.     (void) strcat( returnval, (char *) name);
  2371.     break;
  2372.     
  2373.     case 4:
  2374.     (void) strcpy( returnval, "math begin " );
  2375.     (void) strcat( returnval, (char *) name);
  2376.     break;
  2377.     
  2378.     case 5:
  2379.     (void) strcpy( returnval, "display math begin " );
  2380.     (void) strcat( returnval, (char *) name);
  2381.     break;
  2382.     
  2383.     default:
  2384.         (void) strcpy( returnval, name );
  2385.     
  2386.     }
  2387.     
  2388.     return ((char *)returnval);
  2389. }
  2390.  
  2391. char *eg_command(name,type)
  2392. int type;
  2393. char *name;
  2394. {
  2395.     
  2396.     switch (type) {
  2397.     
  2398.     case 2:
  2399.     (void) strcpy( returnval, "\\end{" );
  2400.     (void) strcat( returnval, (char *) name);
  2401.     (void) strcat( returnval, "}" );
  2402.     break;
  2403.     
  2404.     case 3:
  2405.     (void) strcpy( returnval, "end of file " );
  2406.     (void) strcat( returnval, (char *) name);
  2407.     break;
  2408.     
  2409.     case 4:
  2410.     (void) strcpy( returnval, "math end " );
  2411.     (void) strcat( returnval, (char *) name);
  2412.     break;
  2413.     
  2414.     case 5:
  2415.     (void) strcpy( returnval, "display math end " );
  2416.     (void) strcat( returnval, (char *) name);
  2417.     break;
  2418.     
  2419.     default:
  2420.         (void) strcpy( returnval, name );
  2421.     break;
  2422.     }
  2423.     
  2424.     return ((char *)returnval);
  2425. }
  2426.  
  2427.  
  2428. void g_checkend(n)
  2429. int n;
  2430. {
  2431.     if ( check_top_level_end(yytext,n) == 1 ) 
  2432.        if (  CG_TYPE != n  )
  2433.      print_bad_match(yytext,n);
  2434.        else
  2435.     pop();
  2436. }
  2437.  
  2438. void e_checkend(n, name)
  2439. int n;
  2440. char *name;
  2441. {
  2442.    if ( check_top_level_end(name,n) == 1 )
  2443.     {
  2444.      if (  CG_TYPE != n  ||  strcmp( CG_NAME, name ) != 0 )
  2445.         print_bad_match(name,n);
  2446.  
  2447.      pop();
  2448.  
  2449.     }
  2450. }
  2451.  
  2452. void f_checkend(name)
  2453. char *name;
  2454. {
  2455.     if ( check_top_level_end(name,3) == 1 )
  2456.      {
  2457.        if (  CG_TYPE != 3  ||  strcmp( CG_NAME, name ) != 0 )
  2458.  
  2459.         while( CG_TYPE != 3  )
  2460.     {
  2461.       print_bad_match(name,3);
  2462.           pop();
  2463.         }
  2464.  
  2465.          pop();  
  2466.      }
  2467. }
  2468.  
  2469. void print_bad_match(end_command,type)
  2470. char *end_command;          
  2471. int type;
  2472. {
  2473.       printf("\"%s\", line %i: <- unmatched \"%s\"\n",
  2474.              file_name, 
  2475.          line_count, 
  2476.          eg_command( end_command , type) ) ;
  2477.  
  2478.       printf("\"%s\", line %i: -> unmatched \"%s\"\n",
  2479.              CG_FILE, 
  2480.          CG_LINE, 
  2481.          bg_command( CG_NAME ) ) ;
  2482.       warn_count += 2;
  2483. }
  2484.  
  2485. int check_top_level_end(end_command,type)
  2486. char *end_command;          
  2487. int type;
  2488. {
  2489.     if ( gstackp == 0 )
  2490.     {
  2491.      printf("\"%s\", line %i: \"%s\" found at top level\n",
  2492.            file_name, 
  2493.            line_count, 
  2494.            eg_command( end_command, type )) ;
  2495.      ++warn_count;
  2496.          return(0);
  2497.     }
  2498.     else
  2499.         return(1);
  2500. }
  2501.  
  2502.  
  2503.  
  2504.